-
-
Save navanathjadhav/c410fe0dec7435435d29753936100557 to your computer and use it in GitHub Desktop.
Example of limit the number of records
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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