Reputation: 6102
In my Meteor application, in lib
folder (the folder that all code will be executed first). I create a file name database.js
which contains:
tblUser = new Mongo.collection("Users");
tblComment = new Mongo.collection("Comments");
By use this way, I think:
tblUser
and tblComment
is global variable, so can access like we get a table from database.Are 2 above assumptions right ? If wrong, please correct me.
Thanks :)
Upvotes: 0
Views: 178
Reputation: 1016
A meteor project have the autopublish and insecure packages. So, you should remove it and use a publish - suscribe policy in your application.
Remember, mongodb is no-sql, the collections don't will be created until you do the first insert.
Upvotes: 1
Reputation: 1881
Your assumptions are correct, you just gotta remember about good pub/sub code.
Although, if you still got autopublish package then yes, your Collections are something like tables that hold same data as server, you just gotta fetch()
them like tblUser.find().fetch()
Upvotes: 2