There's a ['title'] attribute inside each document. How can I do a .find, but only display the title?开发者_StackOverflow
You can retrieve a subset of fields within the documents as follows:
e.g. looking retrieving only the title field for books with a given ISBN:
db.Books.find({ISBN : "1234567890" }, { title : 1 } );
You can also do field negation, i.e. return all fields EXCEPT the ones you specify. There's a good reference on this on MongoDB.org
you can find that info at http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields
精彩评论