Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Created June 20, 2022 15:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Example of limit the number of records
/*
* Use $limit if you are using aggregate
*/
db.users.aggregate([
{
$limit: 10,
},
]);
/*
* Use Schema.limit if you are using mongoose
*/
UserSchema.find().limit(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment