mongodb CRUD
Shell into mongodb, pick the test database.
[code language=”shell”]
mongo
use test;
[/code]
Create a document in the people collection.
[code language=”javascript”]
db.people.insert({"name":"Ken", "career":"Writer", "interests":["writing", "reading"]});
[/code]
Read a document in the people collection.
[code language=”javascript”]
db.people.find({"name":"Ken"});
[/code]
Update a document in the people collection.
[code language=”javascript”]
db.people.update({"name":"Ken"},{$set:{"career":"Programmer"}, $push:{"interests":"coding"}});
[/code]
Delete a document in the people collection.
[code language=”javascript”]
db.people.remove({"name":"Ken"});
[/code]
Search within Codexpedia

Custom Search
Search the entire web

Custom Search
Related Posts