Database connection and location
Meteor projects use MongoDB by default out of the box using the mongo core package.
The connection mode and target are determined by environment variables.
MONGO_URL
(development, production)
MongoDB server URL. Give a fully qualified URL (or comma-separated list of URLs) like
MONGO_URL="mongodb://user:[email protected]:10139".
For more information see the MongoDB docs.
MONGO_OPLOG_URL
(development, production)
MongoDB server oplog URL. If you’re using a replica set (which you should), construct this url like so:
MONGO_OPLOG_URL="mongodb://user:[email protected]:10139/local?replicaSet=(your replica set)&authSource=(your auth source)"
The MONGO_URL is required in a built application (normally running in production).
In development mode (i.e, run by the meteor run command, which is likely the case in your scenario), if the above environment variables are not set, the Meteor utility creates a default database (stored inside the .meteor directory) and runs it at the next available port following your app's port (e.t, on the default port 3000, the DB will be available at port 3001).
The meteor mongo -U command prints out the mongo connection string. It is typically something like mongodb://127.0.0.1:3001/meteor for the default settings.
This means you can access it from your console (BTW, the meteor mongo command gives you a DB prompt) or a GUI database inspector.
The MONGO_OPLOG_URL is used for enhancing performance.
Collection creation
The mongo package does not create collections if there is no need to, so simply declaring a Mongo.Collection in your code will not immediately create it. Some operations trigger the creation of a non-existing collections. For example, inserting a document or creating an index.