0

I have a Datagrid.Backend i am using MongoDB.I heard that MongoDB supports Pagination ie we did not retrive all data.We have to set itemsPerPage.Then client send pagenumber as input.Depending on input no o records are retrieved.So that for large volume of data system do not crash.I found one query from this forums.

DataGrid Pagination using Mongo dB?

query is

db.your_collection.find().skip(20).limit(10)

When i wrote above query limit(10) is not coming while type in visualstudio(intelligence is not coming)

Can any one help on this?

Community
  • 1
  • 1
user768853
  • 269
  • 1
  • 4
  • 16

2 Answers2

1

You can use the SetSkip(skip: int) and SetLimit(limit: int) methods in the MongoCursor class to get your job done.

e.g.:

var results = collection.Find().SetSkip(20).SetLimit(10).ToList();
kratenko
  • 7,354
  • 4
  • 36
  • 61
0

Skip and Limit are properties on the cursor so you would have to do something like this with the C# driver.

var cursor = collection.Find();
cursor.Skip = 20;
cursor.Limit = 10;
return cursor.ToList();
Michael DeBerry
  • 183
  • 1
  • 9