Skip to content

Instantly share code, notes, and snippets.

@wtrocki
Created July 28, 2017 12:49
Show Gist options
  • Select an option

  • Save wtrocki/16631d12cf433bcaf854d2f825f761ca to your computer and use it in GitHub Desktop.

Select an option

Save wtrocki/16631d12cf433bcaf854d2f825f761ca to your computer and use it in GitHub Desktop.
Database update script for adding assignee field
// Database update script for adding assignee field
use raincatcher;
db.getCollection('workorders').find({},
{ id: 1, assignee: 1 }).forEach(function(workorder) {
db.getCollection('result').
updateMany({ workorderId: workorder.id },
{ $set: { assignee: workorder.assignee } });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment