1
MongoDB is a NoSQL, non-relational database that uses documents (BSON) instead of tables. Unlike SQL, it does not support joins, relying instead on references between documents.
2
While MongoDB uses JSON-like syntax, it stores data as BSON (Binary JSON). The key difference is that BSON requires quotation marks around both keys and values.
3
The 'mongod' command starts the database server, while 'mongo' opens the interactive shell. Common shell commands include 'show dbs', 'use [db_name]', 'db.collection.find()', and 'db.collection.insert()'.
4
CRUD Operations: Use 'insert()' to add data, 'update()' with '$set' to modify existing documents, and 'remove()' to delete records. The 'upsert: true' option allows creating a document if it does not exist during an update.
5
Querying: Queries use methods like 'find()'. Operators like '$gt' (greater than), '$lt' (less than), and '$in' allow for filtering. Results can be chained with '.pretty()' for readability, '.sort()' for ordering (1 for ascending, -1 for descending), and '.limit()' to restrict output.
6
The Mongo shell acts as a JavaScript interpreter, allowing for the execution of standard JavaScript logic, such as for-loops, to perform bulk operations.