$skip and $limit in aggregation frameworkMongoDB PHP Aggregate with $group and $matchNoSQL (MongoDB) vs Lucene (or Solr) as your databaseMongoDB row index limit query like SQLmongoDB $sort inconsistent resultsNoSQL (MongoDB) vs Lucene (or Solr) as your database“Large data” work flows using pandasHow do you tell Mongo to sort a collection before limiting the results?Mongodb aggregation $group followed by $limit for paginationHow to apply correctly $limit and $skip in subfields?Should I use the “allowDiskUse” option in a product environment?MongoDB Mgo Sort Skip Limit Aggregation Pipeline - Results out of ordersort() operation exceeds max memory in MongoDB Stitch function despite limit()Mongodb aggregation skip and limit with sorting bring duplicate records in paginationMongo DB skip and limit
How to get the decimal part of a number in apex
Why always 4...dxc6 and not 4...bxc6 in the Ruy Lopez Exchange?
Why was Gemini VIII terminated after recovering from the OAMS thruster failure?
How can I finally understand the confusing modal verb "мочь"?
Range hood vents into crawl space
why it is 2>&1 and not 2>>&1 to append to a log file
Employee is self-centered and affects the team negatively
What detail can Hubble see on Mars?
When does WordPress.org notify sites of new version?
Why did Dr. Strange keep looking into the future after the snap?
Appropriate age to involve kids in life changing decisions
Why is the episode called "The Last of the Starks"?
call() a function within its own context
Where do 5 or more U.S. counties meet in a single point?
My C Drive is full without reason
Assuming a normal distribution: what is the sd for a given mean?
What's the 2-minute timer on mobile Deutsche Bahn tickets?
What did Varys actually mean?
Select list elements based on other list
All of my Firefox add-ons have been disabled suddenly, how can I re-enable them?
Drug Testing and Prescribed Medications
shebang or not shebang
Can anyone identify this unknown 1988 PC card from The Palantir Corporation?
In the figure, a quarter circle, a semicircle and a circle are mutually tangent inside a square of side length 2. Find the radius of the circle.
$skip and $limit in aggregation framework
MongoDB PHP Aggregate with $group and $matchNoSQL (MongoDB) vs Lucene (or Solr) as your databaseMongoDB row index limit query like SQLmongoDB $sort inconsistent resultsNoSQL (MongoDB) vs Lucene (or Solr) as your database“Large data” work flows using pandasHow do you tell Mongo to sort a collection before limiting the results?Mongodb aggregation $group followed by $limit for paginationHow to apply correctly $limit and $skip in subfields?Should I use the “allowDiskUse” option in a product environment?MongoDB Mgo Sort Skip Limit Aggregation Pipeline - Results out of ordersort() operation exceeds max memory in MongoDB Stitch function despite limit()Mongodb aggregation skip and limit with sorting bring duplicate records in paginationMongo DB skip and limit
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
When I read the document I found the following notes:
When a $sort immediately precedes a $limit in the pipeline, the $sort operation only maintains the top n results as it progresses, where n is the specified limit, and MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
If I'm right about this, it applies only when I use the $sort and $limit together like
db.coll.aggregate([
...,
$sort: ...,
$limit: limit,
...
]);
However, I think most of the time we would have
db.coll.aggregate([
...,
$sort: ...,
$skip: skip,
$limit: limit,
...
]);
Question 1: Does it mean the rule above doesn't apply if I use $skip here?
I ask this question because theoretically MongoDB can still calculate the top n records and enhance performance by sorting only top n records. I didn't find any document about this though. And if the rule doesn't apply,
Question 2: Do I need to change my query to the following to enhance performance?
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
$limit: limit,
...
]);
EDIT: I think explains my use case would make the question above makes more sense. I'm using the text search feature provided by MongoDB 2.6 to look for products. I'm worried if the user inputs a very common key word like "red", there will be too many results returned. Thus I'm looking for better ways to generate this result.
EDIT2: It turns out that the last code above equals to
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
...
]);
Thus I we can always use this form to make the top n rule apply.
mongodb aggregation-framework
add a comment |
When I read the document I found the following notes:
When a $sort immediately precedes a $limit in the pipeline, the $sort operation only maintains the top n results as it progresses, where n is the specified limit, and MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
If I'm right about this, it applies only when I use the $sort and $limit together like
db.coll.aggregate([
...,
$sort: ...,
$limit: limit,
...
]);
However, I think most of the time we would have
db.coll.aggregate([
...,
$sort: ...,
$skip: skip,
$limit: limit,
...
]);
Question 1: Does it mean the rule above doesn't apply if I use $skip here?
I ask this question because theoretically MongoDB can still calculate the top n records and enhance performance by sorting only top n records. I didn't find any document about this though. And if the rule doesn't apply,
Question 2: Do I need to change my query to the following to enhance performance?
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
$limit: limit,
...
]);
EDIT: I think explains my use case would make the question above makes more sense. I'm using the text search feature provided by MongoDB 2.6 to look for products. I'm worried if the user inputs a very common key word like "red", there will be too many results returned. Thus I'm looking for better ways to generate this result.
EDIT2: It turns out that the last code above equals to
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
...
]);
Thus I we can always use this form to make the top n rule apply.
mongodb aggregation-framework
add a comment |
When I read the document I found the following notes:
When a $sort immediately precedes a $limit in the pipeline, the $sort operation only maintains the top n results as it progresses, where n is the specified limit, and MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
If I'm right about this, it applies only when I use the $sort and $limit together like
db.coll.aggregate([
...,
$sort: ...,
$limit: limit,
...
]);
However, I think most of the time we would have
db.coll.aggregate([
...,
$sort: ...,
$skip: skip,
$limit: limit,
...
]);
Question 1: Does it mean the rule above doesn't apply if I use $skip here?
I ask this question because theoretically MongoDB can still calculate the top n records and enhance performance by sorting only top n records. I didn't find any document about this though. And if the rule doesn't apply,
Question 2: Do I need to change my query to the following to enhance performance?
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
$limit: limit,
...
]);
EDIT: I think explains my use case would make the question above makes more sense. I'm using the text search feature provided by MongoDB 2.6 to look for products. I'm worried if the user inputs a very common key word like "red", there will be too many results returned. Thus I'm looking for better ways to generate this result.
EDIT2: It turns out that the last code above equals to
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
...
]);
Thus I we can always use this form to make the top n rule apply.
mongodb aggregation-framework
When I read the document I found the following notes:
When a $sort immediately precedes a $limit in the pipeline, the $sort operation only maintains the top n results as it progresses, where n is the specified limit, and MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
If I'm right about this, it applies only when I use the $sort and $limit together like
db.coll.aggregate([
...,
$sort: ...,
$limit: limit,
...
]);
However, I think most of the time we would have
db.coll.aggregate([
...,
$sort: ...,
$skip: skip,
$limit: limit,
...
]);
Question 1: Does it mean the rule above doesn't apply if I use $skip here?
I ask this question because theoretically MongoDB can still calculate the top n records and enhance performance by sorting only top n records. I didn't find any document about this though. And if the rule doesn't apply,
Question 2: Do I need to change my query to the following to enhance performance?
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
$limit: limit,
...
]);
EDIT: I think explains my use case would make the question above makes more sense. I'm using the text search feature provided by MongoDB 2.6 to look for products. I'm worried if the user inputs a very common key word like "red", there will be too many results returned. Thus I'm looking for better ways to generate this result.
EDIT2: It turns out that the last code above equals to
db.coll.aggregate([
...,
$sort: ...,
$limit: skip + limit,
$skip: skip,
...
]);
Thus I we can always use this form to make the top n rule apply.
mongodb aggregation-framework
mongodb aggregation-framework
edited Jun 12 '14 at 2:00
yaoxing
asked Jun 11 '14 at 10:01
yaoxingyaoxing
2,49821326
2,49821326
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Since this is a text search query we are talking about then the most optimal form is this:
db.collection.aggregate([
"$match":
"$text": "$search": "cake tea"
,
{ "$sort": "score": "$meta": "textScore" ,
"$limit": skip + limit ,
"$skip": skip
])
The rationale on the memory reserve from the top "sort" results will only work within it's own "limits" as it were and this will not be optimal for anything beyond a few reasonable "pages" of data.
Beyond what is reasonable for memory consumption, the additional stage will likely have a negative effect rather than positive.
These really are the practical limitations of the text search capabilities available to MongoDB in the current form. But for anything more detailed and requiring more performance, then just as is the case with many SQL "full text" solutions, you are better off using an external "purpose built" text search solution.
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24160037%2fskip-and-limit-in-aggregation-framework%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Since this is a text search query we are talking about then the most optimal form is this:
db.collection.aggregate([
"$match":
"$text": "$search": "cake tea"
,
{ "$sort": "score": "$meta": "textScore" ,
"$limit": skip + limit ,
"$skip": skip
])
The rationale on the memory reserve from the top "sort" results will only work within it's own "limits" as it were and this will not be optimal for anything beyond a few reasonable "pages" of data.
Beyond what is reasonable for memory consumption, the additional stage will likely have a negative effect rather than positive.
These really are the practical limitations of the text search capabilities available to MongoDB in the current form. But for anything more detailed and requiring more performance, then just as is the case with many SQL "full text" solutions, you are better off using an external "purpose built" text search solution.
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
|
show 2 more comments
Since this is a text search query we are talking about then the most optimal form is this:
db.collection.aggregate([
"$match":
"$text": "$search": "cake tea"
,
{ "$sort": "score": "$meta": "textScore" ,
"$limit": skip + limit ,
"$skip": skip
])
The rationale on the memory reserve from the top "sort" results will only work within it's own "limits" as it were and this will not be optimal for anything beyond a few reasonable "pages" of data.
Beyond what is reasonable for memory consumption, the additional stage will likely have a negative effect rather than positive.
These really are the practical limitations of the text search capabilities available to MongoDB in the current form. But for anything more detailed and requiring more performance, then just as is the case with many SQL "full text" solutions, you are better off using an external "purpose built" text search solution.
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
|
show 2 more comments
Since this is a text search query we are talking about then the most optimal form is this:
db.collection.aggregate([
"$match":
"$text": "$search": "cake tea"
,
{ "$sort": "score": "$meta": "textScore" ,
"$limit": skip + limit ,
"$skip": skip
])
The rationale on the memory reserve from the top "sort" results will only work within it's own "limits" as it were and this will not be optimal for anything beyond a few reasonable "pages" of data.
Beyond what is reasonable for memory consumption, the additional stage will likely have a negative effect rather than positive.
These really are the practical limitations of the text search capabilities available to MongoDB in the current form. But for anything more detailed and requiring more performance, then just as is the case with many SQL "full text" solutions, you are better off using an external "purpose built" text search solution.
Since this is a text search query we are talking about then the most optimal form is this:
db.collection.aggregate([
"$match":
"$text": "$search": "cake tea"
,
{ "$sort": "score": "$meta": "textScore" ,
"$limit": skip + limit ,
"$skip": skip
])
The rationale on the memory reserve from the top "sort" results will only work within it's own "limits" as it were and this will not be optimal for anything beyond a few reasonable "pages" of data.
Beyond what is reasonable for memory consumption, the additional stage will likely have a negative effect rather than positive.
These really are the practical limitations of the text search capabilities available to MongoDB in the current form. But for anything more detailed and requiring more performance, then just as is the case with many SQL "full text" solutions, you are better off using an external "purpose built" text search solution.
edited Jun 12 '14 at 6:00
answered Jun 11 '14 at 11:11
Neil LunnNeil Lunn
102k23183189
102k23183189
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
|
show 2 more comments
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
You say in the current form. Is there work underway to enhance MongoDB text search, do you know? There are some great comments here on using Solr in conjunction with MongoDB stackoverflow.com/questions/3215029/…,
– John Powell
Jun 11 '14 at 11:19
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
@JohnBarça The answer you seek is actually more "official" and slightly loaded in nature. IMO MongoDB admittedly does not try to be an "optimal" key/value store nor does it try to implement every feature of a traditional relational system as a "database" goes. The extension of this is that a general purpose "database" generally does not "go in for" specialized areas such as "text search". But that is an opinion, and perspectives are often subject to change. By all means, use what works best.
– Neil Lunn
Jun 11 '14 at 11:35
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
Interesting. I have been dabbling in Mongo and really like certain features. But I hear what you are saying. I'm a GIS guy and I like the geojson stuff that has been done and the aggregation spatial enhancements, but in terms of functionality still a long way from being able to leave Postgres/Postgis. I accept this is a very niche area, though.
– John Powell
Jun 11 '14 at 12:09
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
@JohnBarça I agree with you guys. This is only a temp solution with which I can do it quick and simple. We did think of integrating a search engine. But not until the next phase because it would have brought too much extra work load now. And it has been much better than the "like" search we are using now:)
– yaoxing
Jun 11 '14 at 13:34
1
1
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
I kept thinking about this and I think I understood why MongoDB only allow $limit other than $skip to apply the top n rule. Because skip+limit can always be turned to limit+skip. I edit my question.
– yaoxing
Jun 12 '14 at 2:03
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24160037%2fskip-and-limit-in-aggregation-framework%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown