[CSHARP-1638] MongoDB Driver 2.2.3 IMongoCollection paging Created: 26/Apr/16 Updated: 05/Apr/19 Resolved: 16/May/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.2.3 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Bilgehan | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hi,
I can query with database pagination with MongoCollection. new driver I change it to IMongoCollection IMongoCollection.AsQueryable<TEntity>().Skip(skip).Take(count)
For example But I want to get first ten records which Name is a,and with this I can make database pagination.With old driver I brings first ten records which matches a,What should I do to achive database pagination in new driver with IMongoCollection Thanks |
| Comments |
| Comment by Bilgehan [ 27/Apr/16 ] | |
|
Hi Craig You are right,I can able to do that change query {aggregate([{ "$match" : { "Name" : a }}, { "$skip" : 40 }, { "$limit" : 10 }])} , As I see implementation is change in new driver I can use as I said in previous version. I change my code Thanks for your help | |
| Comment by Craig Wilson [ 26/Apr/16 ] | |
|
Hi Bilgehan, Queryable's are order sensitive. In other words, if you do a Skip and Take before a Where, then that's the order in which things are going to happen. Hence, you need to add your paging information at the end, right before execution as opposed to at the beginning.
Let me know if this needs further explanation. |