Mongo runCommand paging

  mongodb, question

Since it is necessary to query data according to distance and display distance based on mongo spatial index, the query must be carried out in the following way.

db.runCommand({"geoNear":"coach2", "near":[113.525298,22.246466],"num":10, spherical:true,distanceMultiplier: 6378137,maxDistance:100/6378137, query:{account:"tcrct"}}

Num controls the number of returned items.

But now I want to realize paging function, 20 pages per page. I don’t see similar options for runCommand to support skip in the manual. So I don’t know how to realize paging.

The landlord is obviously familiar with the basic limit and skip. .

The mongodb mentioned by the host does not support it at present, but you can do it through aggreation. The document is inHere. This supports limit and skip, which is also the current recommended practice.