Skip to content

Commit 310bea7

Browse files
authored
Merge pull request #214 from vi-ssc/main
Allows pagination for MongoDB
2 parents 825e341 + fe5d201 commit 310bea7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/adapters/datasources/datasource-mongodb.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,13 @@ export class DataSourceMongoDb extends DataSourceMemory {
252252
*
253253
* @returns
254254
*/
255-
async mongoFind ({ filter, sort, limit, aggregate, skip, offset } = {}) {
256-
console.log({ filter })
255+
async mongoFind ({ filter, sort, limit, aggregate, skip } = {}) {
256+
console.log('Aegis MongoDataAdapter: filter',{ filter })
257257
let cursor = (await this.collection()).find(filter)
258258
if (sort) cursor = cursor.sort(sort)
259-
if (limit) cursor = cursor.limit(limit)
260259
if (aggregate) cursor = cursor.aggregate(aggregate)
260+
if (skip) cursor = cursor.skip(skip)
261+
if (limit) cursor = cursor.limit(limit)
261262
return cursor
262263
}
263264

0 commit comments

Comments
 (0)