Skip to content

Commit e26f394

Browse files
committed
fix bug in lokidb limit/sorting
1 parent 43917d6 commit e26f394

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/bouncer/db/loki-db.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = class LokiDb extends IDb {
191191

192192
debug('find collection=', collectionName, ' query=', JSON.stringify(query,null,2))
193193
let collection = await this.getCollection(collectionName)
194-
let resultSet = collection.find(query)
194+
let resultSet = collection.chain().find(query)
195195

196196

197197
if(mongoQuery.hasLimit()){
@@ -203,7 +203,7 @@ module.exports = class LokiDb extends IDb {
203203
resultSet = resultSet.simplesort( sortPath )
204204
}
205205

206-
return resultSet.map(this.documentToObject) || []
206+
return resultSet.data().map(this.documentToObject) || []
207207
}
208208

209209
async insertMany(collectionName, docs){

0 commit comments

Comments
 (0)