Skip to content

Instantly share code, notes, and snippets.

@npentrel
Created September 14, 2018 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npentrel/52c092e74c3bf8e5ddb461526458373c to your computer and use it in GitHub Desktop.
Save npentrel/52c092e74c3bf8e5ddb461526458373c to your computer and use it in GitHub Desktop.
> db.alphabet.insert({
"_id": "77777",
"array": ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
})
> db.alphabet.update(
{ "_id": "77777" },
{
$push: {
array: {
$each: ['j']
}
}
}
)
// Check the results:
> db.alphabet.find({ "_id": "77777" })
{ "array" : [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment