聚合_limit_skip_out的用法

1. 只显示前两条数据
db.emps.aggregate([
    {"$project":{"_id":0, "name":1, "salary":1, "job":1}},
    {"$limit":2}
    ])
2.跳过1条然后只显示2条数据
db.emps.aggregate([
    {"$project":{"_id":0, "name":1, "salary":1, "job":1}},
    {"$skip":1},
    {"$limit":2}
    ])
  1. $out
发布了298 篇原创文章 · 获赞 153 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_43192537/article/details/103792718