meteor-admin
meteor-admin copied to clipboard
Getting Post Error Using With Meteor
I have this code in both/app.js
AdminConfig = { collections: { Posts: {} } };
But I am getting the following error: Your app is crashing. Here's the latest log.
throw(ex);
^
Error: Posts is not in the [object global] at lookup (packages/yogiben:admin/lib/both/utils.coffee:22:14) at adminCollectionObject (packages/yogiben:admin/lib/both/utils.coffee:5:3) at packages/yogiben:admin/lib/both/startup.coffee:103:16 at Function..each..forEach (packages/underscore/underscore.js:113:1) at adminCreateTables (packages/yogiben:admin/lib/both/startup.coffee:77:4) at __coffeescriptShare (packages/yogiben:admin/lib/both/startup.coffee:185:2) at C:\Users\steph_000\Documents\My Projects\testbasic.meteor\local\build\programs\server\boot.js:229:5 Exited with code: 8 Your application is crashing. Waiting for file change.
Any Ideas because if I put this code in just the client side it works fine.
I was trying to change the Posts collection to a custom collection and got the same error. I'm wondering if you found a solution yet?
Same error here
from https://forums.meteor.com/t/yogiben-admin-with-meteor-1-3-global-var-issue/27024 :
option 1 : use collectionObject
AdminConfig =
{
adminEmails: ['[email protected]'],
collections:
{
Posts: { collectionObject: new Mongo.Collection("posts") }
}
};
option 2 : declare your collection globally
in collections/posts.js
(can be any folder that is imported by both server and client) :
Posts = _Posts // no var, let, const, etc.
and where your AdminConfig
is defined :
import Posts as _Posts from '../collections/posts.js'
AdminConfig =
{
adminEmails: ['[email protected]'],
collections:
{
Posts: {}
}
};