Databases Reference
In-Depth Information
CHAPTER 7
Advanced Topics
MongoDB supports some advanced functionality that goes well beyond the capabilities
discussed so far. When you want to become a power user, this chapter has you covered;
in it we'll discuss the following:
• Using database commands to take advantage of advanced features
• Working with capped collections, a special type of collection
• Leveraging GridFS for storing large files
• Taking advantage of MongoDB's support for server-side JavaScript
• Understanding what database references are and when you should consider using
them
Database Commands
In the previous chapters we've seen how to create, read, update, and delete documents
in MongoDB. In addition to these basic operations, MongoDB supports a wide range
of advanced operations that are implemented as commands . Commands implement all
of the functionality that doesn't fit neatly into “create, read, update, delete.”
We've already seen a couple of commands in the previous chapters; for instance, we
used the getLastError command in Chapter 3 to check the number of documents af-
fected by an update:
> db.count.update({x : 1}, {$inc : {x : 1}}, false, true)
> db.runCommand({getLastError : 1})
{
"err" : null,
"updatedExisting" : true,
"n" : 5,
"ok" : true
}
 
Search WWH ::




Custom Search