How do I limit the number of returned items?

前端 未结 7 1842
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 15:32
myModel.find({}, function(err, items) {
    console.log(items.length);    // Big number
});

How can I limit the returned items to only the latest

相关标签:
7条回答
  • 2020-11-27 16:20

    ...additionally make sure to use:

    mongoose.Promise = Promise;
    

    This sets the mongoose promise to the native ES6 promise. Without this addition I got:

    DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html

    0 讨论(0)
提交回复
热议问题