Last active
March 16, 2021 13:54
-
-
Save mumunuu/b7aac4ce613e469236f7430dd462f132 to your computer and use it in GitHub Desktop.
mongodb-pagination-2
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
db | |
.myCollection1 | |
.aggregate([ | |
{ | |
"$match": { | |
"status": true | |
} | |
}, | |
// case1 | |
{ | |
"$lookup": { ...생략} | |
} | |
{"$sort": {"publishedAt" : -1}}, | |
{"$skip": 20}, | |
{"$limit": 20}, | |
// case2 | |
{ | |
"$lookup": { ...생략} | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment