Today I wrote a Python script in order to insert data into Meteor’s MongoDB instance, and the first question that came up was how to get hold of the connection parameters. It turns out that Meteor has a command for this purpose:
meteor mongo -U [site]
If you leave out the ‘site’ argument, you’ll get the URL to connect to the local MongoDB instance for the current Meteor app (relative to the directory you’re in). The output will look something like mongodb://127.0.0.1:3001/meteor. The final component of the URL is the name of the database (‘meteor’).
If you supply the site argument however, e.g. meteor mongo -U musitechhub.meteor.com, you’ll get a temporary URL that you must use within one minute. Make sure you use the URL as is, including the database name part at the end, or you might get a connection error.