You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
479 B
Plaintext

// Show number of documents in the collection
db.books.find().count()
// Limit the number of documents to return
db.books.find().limit(2)
// Return the result set after skipping the first n number of documents
db.books.find().skip(2)
// Sort the documents in a result set in ascending or descending order of field values
db.books.find().sort( {title : 1} )
// value = 1 for ascending, -1 for descending
// Display formatted (more readable) result
db.books.find({}).pretty()