Skip to content

Instantly share code, notes, and snippets.

@horsey
Created August 2, 2015 20:53
Show Gist options
  • Select an option

  • Save horsey/c3f96f103b4477e250f3 to your computer and use it in GitHub Desktop.

Select an option

Save horsey/c3f96f103b4477e250f3 to your computer and use it in GitHub Desktop.
//variable data is JSON string
db.collection('objects').update({
_key: key,
'secretary.username': options.username
}, {
$addToSet: {
"secretary.$" : data
}
}, {
upsert: true, w: 1
}, function(err, result) {
if (err) {
return cb(err, null);
}
return cb(null, result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment