Skip to content

Instantly share code, notes, and snippets.

@nirebu
Last active July 19, 2018 13:45
Show Gist options
  • Save nirebu/6a02a910e4dd145e9cf85bba76e54f12 to your computer and use it in GitHub Desktop.
Save nirebu/6a02a910e4dd145e9cf85bba76e54f12 to your computer and use it in GitHub Desktop.
[MongoDB batch boilerplate] Basic boilerplate code for mongo shell batch scripts #mongodb
print(new Date() + ' Script launched');
const dbName = "";
const inputCollection = "";
const outputCollection = "";
let conn = new Mongo({w:1, journal:false, safe: true});
let dbConn = conn.getDB(dbName);
let collIn = dbConn[inputCollection];
let collOut = dbConn[outputCollection];
//BATCH CODE HERE
print(new Date() + ' Script ended');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment