How can I create a new db?
implicit with use statement (directory created as soon as data is inserted, there are no empty databases, empty is automatically removed)
-> use newdb
How can I insert?
dbname.collection.insert({ “field”: 123 })
How can I delete?
Explicit (drops database with data)
dbname.runCommand({ dropDatabase: 1 })
or with wrapper command
db.dropDatabase()
What are capped Collections?
collections with a max size defined during creation
- follows the FIFO principle
db.createCollection(“capping”, {capped: true, size:4096, max: 10})
What are Time Series Collections?
stores sequences of measurements effectively
What are Embedded Documents?
a field can contain arrays or documents
How is a MongoDB find query structured?
db.<collection>.find(<criteria>, <projection>)</projection></criteria></collection>
What is a MongoDB Cursor?
When running find, the result is returned as a cursor / a iterator over a result set.
var cursor = db.<collection>.find({ "user_verified": true }, { text: 1, "user_verified": 1, "user.screen_name": 1, "user.friends_count": 1})</collection>
further cursor commands in pdf 4