|
|
@ -668,7 +668,7 @@ class Datastore extends EventEmitter { |
|
|
|
* @private |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async _getCandidatesAsync (query, dontExpireStaleDocs = false) { |
|
|
|
async _getCandidatesAsync (query, dontExpireStaleDocs = false) { |
|
|
|
const validDocs = [] |
|
|
|
let validDocs = [] |
|
|
|
|
|
|
|
|
|
|
|
// STEP 1: get candidates list by checking indexes from most to least frequent usecase
|
|
|
|
// STEP 1: get candidates list by checking indexes from most to least frequent usecase
|
|
|
|
const docs = this._getRawCandidates(query) |
|
|
|
const docs = this._getRawCandidates(query) |
|
|
@ -684,7 +684,7 @@ class Datastore extends EventEmitter { |
|
|
|
for (const _id of expiredDocsIds) { |
|
|
|
for (const _id of expiredDocsIds) { |
|
|
|
await this._removeAsync({ _id }, {}) |
|
|
|
await this._removeAsync({ _id }, {}) |
|
|
|
} |
|
|
|
} |
|
|
|
} else validDocs.push(...docs) |
|
|
|
} else validDocs = docs |
|
|
|
return validDocs |
|
|
|
return validDocs |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|