diff --git a/src/structure/storage/interfaces/MongodbTable.js b/src/structure/storage/interfaces/MongodbTable.js index a2c0768..871cdc0 100644 --- a/src/structure/storage/interfaces/MongodbTable.js +++ b/src/structure/storage/interfaces/MongodbTable.js @@ -13,11 +13,15 @@ class MongodbTable { //Data Search - async find(query, opts = {}) { //opts: { projection: ... } + async find(query, opts = {}, { sort, skip, limit } = {}) { //opts: { projection: ... } query = this._handleData(query); if (!this.provider._initialized) return Promise.reject(new Error('MongoDB is not connected.')); const cursor = await this.collection.find(query, opts); + if (sort) cursor.sort(sort); + if (skip) cursor.skip(skip); + if (limit) cursor.limit(limit); + return cursor.toArray(); }