To list the current datbase.
To switch to a different database.
To insert documents (person) into a collection (people).
To show all documents in a collection.
- all MongoDb documents must have an _id field with unique value.
- mongo creates a unique _id value for each field before inserting into the collection.
To iterate over all records in a collection:
Query by example:
Find a single document:
To limit the number of results returned:
You can create a .mongorc.js file which will get loaded each time you start a new mongo session. In this file you can declare functions that you want to make available to each session.
A mongo connection string looks like this:
Mongo stores data in the form of documents. These are JSON-like key value pairs. These documents are BSON documents. This is a binary representation of JSON with additional type information.
Mongo stores all documents in collections. A collection is a group of related documents that have a set of shared common indexes. Collections are analogous to a table in relational databases.
A query targets a specific collection of documents. These specify criteria that identify documents to return. A query can include a projection that specifies the fields from the matching documents to return. You can also modify queries to impose limits, skips and sort orders.
Create, Update and Delete are operations that modify the data of a single collection. For update and delete you can specify the criteria to select the documents to update or remove.
To be continued… more…