mongodb CRUD

Shell into mongodb, pick the test database.

mongo
use test;

Create a document in the people collection.

db.people.insert({"name":"Ken", "career":"Writer", "interests":["writing", "reading"]});

Read a document in the people collection.

db.people.find({"name":"Ken"});

Update a document in the people collection.

db.people.update({"name":"Ken"},{$set:{"career":"Programmer"}, $push:{"interests":"coding"}});

Delete a document in the people collection.

db.people.remove({"name":"Ken"});

Search within Codexpedia

Custom Search

Search the entire web

Custom Search