Hi, my name is Joshua. I am new to development with meteor platform, and it is starting to grow on me. I have these few questions that I’d like to ask, since I didn’t find similar samples on the tutorials. Here are the following:
- Is it ideal to add / incorporate another JS file for something else ( etc function library )?
- Is it normal for an db record ID to be not an Object, but rather a generated string, when added via js ( or form )?
- Is there any means of filtering an object, in such a way that you will have some means to ensure that every object that goes to your database ( mongo in this case ) will be of the same object type? The purpose of this is to maintain integrity in your collection
As a beginner on this, I would surely appreciate any help that I can get. Lastly, I would also like to ask for any recommended books for a meteor + mongodb developer.
It’s no problem to do that. Most Meteor developers prefer to use packages to incorporate libraries, as the package manager is pretty sweet to use and the packages are usually maintained with the latest version of the library, which makes updating a breeze. But Meteor gives you the freedom to include js files wherever you want in your app’s folder structure – I do this sometimes if I’m in a hurry and can’t find the right package. If it’s a library type file, it should probably go in the
/lib folder, as files from that folder are first in the load order.
Yes, most Meteor apps just work with string _id values. I find it easy to work with string _id values, as you can just use them willy-nilly in dom id attributes, as router slugs, etc… Be careful about adding new data directly via the mongo console though, or you’ll end up with some object _id values mixed up with your string _id values.
https://atmospherejs.com/aldeed/collection2 is what you’re after.
Discover Meteor is a favourite book. This is another good one for covering the very basics. Best place to start looking for Meteor learning resources is here.
Thank you very much for the reply. You did me a solid one here.