Meteor error in trying to use collections - mongodb

I am currently pulling data from collections in the MongoDB but there are 2 in particular that will not work either giving me the following error:
Exception from sub Assets id i574gxNDc9RdHERNn TypeError: Cannot call method 'find' of undefined
Or:
TypeError: Cannot call method 'attachSchema' of undefined
Or:
Object # has no method 'attachSchema'
depending on how I configure it. Does anyone have an idea of what I am doing wrong. I am using the same code for the ones that work as well as the ones that are throwing errors.
The collection looks like this:
Assets = Collections.Assets = Meteor.Assets;
Querying in server/publish.js:
Meteor.publish("Assets", function (){
return Meteor.Assets.find({});
});
Changing it to:
new Mongo.Collection('Assets');
Gives error:
Exception from sub Assets id ZgzZyNYPmMr5gtFGn TypeError: Cannot call method 'find' of undefined

Running the following from the command line in the top (root) directory of the project might fix this (it helped me):
meteor add aldeed:collection2

Related

Nwjs how to use evalNWBinModule in another created window?

In the main window I write the following code and it works:
nw.Window.get(null).evalNWBinModule(null, "./my.bin", "./my.js");
import("./my.js");
but if I create a new window via nw.Window.open(MyOtherURL); where I then move this code, then after running I get an error:
Uncaught (in promise) TypeError: Failed to resolve module specifier
'./my.js'
what is the launch difference and what else do i need to configure?
nw.Window.get() returns a reference to the Window itself, so you can then chain off of it.
nw.Window.open(), does not, but it does have a callback function gives you access to the new window, which you can chain off of.
const url = 'page2.html';
const options = {};
nw.Window.open(url, options, function (win) {
win.evalNWBinModule(null, './my.bin', './my.js');
});
However I'm not sure that will do what you want. You will likely be better off having the code run in your page2.html file directly.

Exception - Call to undefined function course_overviewfiles_options()

I am using a Moodle(3.2.2 the newest one) site created by php7.0 and mysql5.7,but when i try to add a new course as administrator, an error called :Exception - Call to undefined function course_overviewfiles_options(). What can i do to fix it?
I did 'Purge all caches' from Development,so the problem above disappeared,but
when users login, another error occurred: Exception - Call to undefined function core_login_get_return_url().
I did 'Purge all caches'again, the problem no.2 disappeared and the no.1 occurred again.
did you include the correct library resource file?
require_once($CFG->libdir. '/coursecatlib.php'); (I think)
HTH

Meteor Angular2 and external changed of Mongodb

I play around with a simple Meteor Angular 2 app which only read from database. I have another app which change the database. But when the database is changed, I got error on Meteor app.
Exception in queued task: EXCEPTION: Error in client/match.html:0:19
ORIGINAL EXCEPTION: TypeError: Cannot read property 'league' of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'league' of undefined
at DebugAppView._View_MatchComponent0.detectChangesInternal (MatchComponent.template.js:101:59)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
at DebugAppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57415:44)
at DebugAppView.AppView.detectViewChildrenChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57346:34)
at DebugAppView._View_MatchesComponent1.detectChangesInternal (MatchesComponent.template.js:106:8)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
at DebugAppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57415:44)
at DebugAppView.AppView.detectContentChildrenChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57341:37)
at DebugAppView._View_MatchesComponent0.detectChangesInternal (MatchesComponent.template.js:65:8)
at DebugAppView.AppView.detectChanges (http://localhost:3001/packages/modules.js?hash=5bea6cc36ccb7076b2a2834b250a3c141ff0cd78:57326:14)
ERROR CONTEXT:
[object Object]
I'm using autopublish which collection:
import {Mongo} from 'meteor/mongo';
export let MatchCollection = new Mongo.Collection('matches');
And angular component:
export class MatchesComponent
{
matches;
constructor() {
this.matches = MatchCollection.find();
}
}
Note: Meteor Blaze version works well. And I'm new to Meteor Angular2.
Thanks for all help.
I guess you are using *ngFor.
You can use this more stable way
this.matches = MatchCollection.find().fetch();
MatchCollection.find(); returns Mongo.Cursor<any>;
MatchCollection.find().fetch(); returns Array<any>
Weird, the bug should be already fixed...
It looks like the external change removed a property names league within the document, which your angular2 view uses somewhere.
Have a look at the document via meteor mongo to see how the document looks like in the storage before and after it has been modified by the external process.

SAPUI5 - Uncaught TypeError: this.getRouter.navTo is not a function

I am referring to the code used in tdg master-detail demokit application.
I am getting an error "Uncaught TypeError: this.getRouter.navTo is not a function".
I have written a console.log("is router fine? "+ this.getRouter().toLocaleString()); before this.getRouter.navTo which prints as
"EventProvider company.accounts_positions_splitpage.MyRouter"
Any suggestions what is the issue?
Thanks
You have to call
this.getRouter().navTo()
instead of
this.getRouter.navTo()
With this.getRouter you do not execute the function, you just get the function as Object. There you try too execute the function navTo(), but that object itselve does not provide such a function.
With this.getRouter() you execute the function and you get the return value (a router) as Object. On that router you can now use navTo(), as you did in your console.log.

Call to a member function get_cart_subtotal() on a non-object in config-woocommerce/config.php on line 790

I'm trying to login into my WordPress Admin panel, and am getting the following error:
Call to a member function get_cart_subtotal() on a non-object in /home/spicom/public_html/adwinang.com/wp-content/themes/enfold/config-woocommerce/config.php on line 790
This is my code at line 790:
$cart_subtotal = $woocommerce->cart->get_cart_subtotal();
It sounds like you haven't called global $woocommerce;, before trying to access the $woocommerce object.
A better way would be to use WC():
$cart_subtotal = WC()->cart->get_cart_subtotal();
Alternatively, it's possible the WooCommerce hasn't even been installed and activated...make sure to do that, if it's a theme dependency.
I had a very similar message.
[25-Sep-2018 10:24:08 UTC] PHP Fatal error: Uncaught Error:
Call to a member function get_cart_subtotal() on null in
themes\storefront\inc\woocommerce\storefront-woocommerce-template-functions.php:80
It was due to me having the following in my wp-config.php file.
define( 'DOING_CRON', false );
I'd added this line while attempting to run something from the command line with W3 Total Cache activated. I didn't realise that it would completely ruin WooCommerce and didn't notice the side effect until attempting to view the site in my browser.