- JSON storage
- schemaless
- NOT support SQL
Functionality that missing in MongoDB (in order to retain scalability):
- Joins between collections
- Transactions across multiple collections
mongoimport -d course -c grades grades.json
mongo
shell is a complete JavaScript environment so we can write:
for (var i=0; i<10; i++) db.things.insert({index: i});
mongo script.js
- run script
- insert or save
- find
- find(...).pretty()
- findOne
- count
- update
- remove
- drop
Data constructors:
- NumberInt(1)
- NumberLong(4)
- ISODate("2012-10-21T17:20:09.759Z")
- sort({name:-1})
- limit(5)
- skip(10)
nodejs methods:
- each
- toArray
- db.persons.update(criteria, newObj, options)
- db.persons.update(criteria, operatorObj, options)
- options: {multi:true}, {upset: true}
- $set
- $unset