Skip to content

Instantly share code, notes, and snippets.

@hicay
Last active September 5, 2017 09:56
Show Gist options
  • Save hicay/385ade8c61890cbffa7a69d42d5d7384 to your computer and use it in GitHub Desktop.
Save hicay/385ade8c61890cbffa7a69d42d5d7384 to your computer and use it in GitHub Desktop.
/* get */
records = [];
var cursor = db.getCollection('tasks').find({}, {});
while(cursor.hasNext()) {
records.push(cursor.next())
}
print(tojson(records));
/* transfer */
db.getCollection('tasks2').insertMany(tojson(records));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment