Created
September 13, 2018 23:47
-
-
Save npentrel/5e1f1cec435843b090633c3787c0969b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.alphabet.insert({ | |
"_id": "00000", | |
"array": ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] | |
}) | |
// We missed the 'i'! | |
// Let's add it in the position before the last element. | |
> db.alphabet.update( | |
{ "_id": "00000" }, | |
{ | |
$push: { | |
array: 'i' | |
} | |
} | |
) | |
// Check the results: | |
> db.alphabet.find({ "_id": "00000" }) | |
{ array : [ "a", "b", "c", "d", "e", "f", "g", "h", "i" ] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment