variety/variety — pull request #17 by kmcgrath (2012-10-31 13:35:15+00:00)
Title: Work with authentication

When authentication is turned on you must log into the admin DB first.

mongo -u USER -p PASS admin --eval "var collection = 'COL' " variety.js

This does not work because variety will look for the collection in the admin DB. You also cannot log into the DB with the collection because variety runs admin commands.

The following code will read from a db_name variable if it exists and set the script to use that DB:

mongo -u USER-p PASS admin --eval "var collection = 'COL', db_name='DB_NAME'" variety.js