亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

數(shù)據(jù)庫 - MongoDB C Driver如何進行分頁?
為情所困
為情所困 2017-05-02 09:20:49
0
3
780

謝謝各位了。這里的問題是沒有找到C接口的分頁查詢的操作。

英文太渣,在mongoDB的網(wǎng)站上沒有發(fā)現(xiàn)分頁相關(guān)的。
http://api.mongodb.com/c/current/tutorial.html
增刪查改和計數(shù)都有,就是沒有發(fā)現(xiàn)分頁操作的。。。

為情所困
為情所困

reply all(3)
漂亮男人

The conventional method is:

db.users.find().skip(pagesize*(n-1)).limit(pagesize)

There is also a way with better performance:

db.users.find().limit(pageSize); //第一頁
last_id = ... //把最后一個_id存下來


users = db.users.find({'_id'> last_id}). limit(10); //第二頁
last_id = ... //更新last_id
洪濤

mongodbLike other databases, you can query the corresponding number of data for paging operations. The official documents also have corresponding instructions, such as mongodb.limit and mongodb.skip. Or you can refer to this Chinese description limit.skip. Hope it helps you

滿天的星座

xxxx.find({'xxx':'xxx'},function(err,rs){

res.json(rs);

}).limit(listnum).sort({'id':-1}).skip((pagenum-1)*listnum);

//listnum is the number of records on a page and pagenum is the page number

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template