There's a ['title'] attribute inside each document. How can I do a .find, but only display the title?
You can retrieve a subset of fields within the documents as follows:
eg 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, ie return all fields EXCEPT the ones you specify. There's a good reference on this on MongoDB.org
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.