91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MongoDB中怎么實現分頁顯示

發布時間:2021-07-16 16:54:30 來源:億速云 閱讀:163 作者:Leah 欄目:關系型數據庫

MongoDB中怎么實現分頁顯示,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。

在MongoDB里面的數據分頁顯示也是符合大數據要求的操作函數:
skip(n):表示跨過多少數據行;
limit(n):取出的數據行的個數限制。

范例:分頁顯示(第一頁,skip(0)、limit(5))
> db.emp.find().skip(0).limit(5).sort({"age":-1}).pretty();
{
        "_id" : ObjectId("599108423268c8e84253be2c"),
        "name" : "鄭七",
        "sex" : "女",
        "age" : 50,
        "sal" : 4700,
        "loc" : "成都"
}
{
        "_id" : ObjectId("599108423268c8e84253be28"),
        "name" : "孫三",
        "sex" : "男",
        "age" : 40,
        "sal" : 2000,
        "loc" : "深圳"
}
{
        "_id" : ObjectId("599148bf0184ff511bf02b95"),
        "name" : "林E",
        "sex" : "男",
        "age" : 40,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "政治"
        ],
        "parents" : [
                {
                        "name" : "林E父親",
                        "age" : 70,
                        "job" : "工人"
                },
                {
                        "name" : "林E母親",
                        "age" : 68,
                        "job" : "局長"
                }
        ]
}
{
        "_id" : ObjectId("599108433268c8e84253be2d"),
        "name" : "王八",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京"
}
{
        "_id" : ObjectId("599129a00184ff511bf02b87"),
        "name" : "劉A",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "數學",
                "英語",
                "音樂",
                "政治"
        ]
}

范例:分頁顯示(第二頁,skip(5)、limit(5))
> db.emp.find().skip(5).limit(5).sort({"age":-1}).pretty();
{
        "_id" : ObjectId("599129a00184ff511bf02b88"),
        "name" : "劉B",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "數學"
        ]
}
{
        "_id" : ObjectId("599129a00184ff511bf02b89"),
        "name" : "劉C",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "數學",
                "英語"
        ]
}
{
        "_id" : ObjectId("599129a00184ff511bf02b8a"),
        "name" : "劉D",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "數學",
                "政治"
        ]
}
{
        "_id" : ObjectId("599129a20184ff511bf02b8b"),
        "name" : "劉E",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "政治"
        ]
}
{
        "_id" : ObjectId("599148bd0184ff511bf02b93"),
        "name" : "林C",
        "sex" : "男",
        "age" : 35,
        "sal" : 8000,
        "loc" : "北京",
        "course" : [
                "語文",
                "數學",
                "英語"
        ],
        "parents" : [
                {
                        "name" : "林C父親",
                        "age" : 60,
                        "job" : "工人"
                },
                {
                        "name" : "林C母親",
                        "age" : 59,
                        "job" : "職員"
                }
        ]
}



看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

上饶县| 合肥市| 宁蒗| 巴南区| 临颍县| 泰安市| 开封县| 滨州市| 抚顺市| 敖汉旗| 宣汉县| 汾西县| 江北区| 汶上县| 云安县| 长治县| 和平县| 澄城县| 商都县| 瑞昌市| 嘉祥县| 惠东县| 祁东县| 翁源县| 宝鸡市| 镇巴县| 江油市| 郁南县| 曲阜市| 涡阳县| 深泽县| 任丘市| 定结县| 邛崃市| 章丘市| 长子县| 涪陵区| 浑源县| 贺州市| 平山县| 民县|