wingbot-mongodb 4.2.8 → 4.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/BaseStorage.js +7 -4
- package/types/BaseStorage.d.ts +2 -1
package/package.json
CHANGED
package/src/BaseStorage.js
CHANGED
|
@@ -181,7 +181,7 @@ class BaseStorage {
|
|
|
181
181
|
* @returns {Promise<import('mongodb').Collection<WithId<T>>>}
|
|
182
182
|
*/
|
|
183
183
|
preHeat () {
|
|
184
|
-
return this._getCollection();
|
|
184
|
+
return this._getCollection(false, true);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -295,9 +295,10 @@ class BaseStorage {
|
|
|
295
295
|
*
|
|
296
296
|
* @protected
|
|
297
297
|
* @param {boolean} [forRead]
|
|
298
|
+
* @param {boolean} [forceIndexAwait=false]
|
|
298
299
|
* @returns {Promise<import('mongodb').Collection<WithId<T>>>}
|
|
299
300
|
*/
|
|
300
|
-
async _getCollection (forRead = false) {
|
|
301
|
+
async _getCollection (forRead = false, forceIndexAwait = false) {
|
|
301
302
|
if (this._collection === null) {
|
|
302
303
|
let c;
|
|
303
304
|
try {
|
|
@@ -311,9 +312,11 @@ class BaseStorage {
|
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
|
|
315
|
+
const requiresIndexAwait = this._shouldWaitForIndex
|
|
316
|
+
&& (!forRead || this._shouldIndexBeforeRead);
|
|
317
|
+
|
|
314
318
|
if (this._indexing
|
|
315
|
-
&&
|
|
316
|
-
&& (!forRead || this._shouldIndexBeforeRead)) {
|
|
319
|
+
&& (requiresIndexAwait || forceIndexAwait)) {
|
|
317
320
|
|
|
318
321
|
const err = await this._indexing;
|
|
319
322
|
this._indexing = false;
|
package/types/BaseStorage.d.ts
CHANGED
|
@@ -131,9 +131,10 @@ declare class BaseStorage<T> {
|
|
|
131
131
|
*
|
|
132
132
|
* @protected
|
|
133
133
|
* @param {boolean} [forRead]
|
|
134
|
+
* @param {boolean} [forceIndexAwait=false]
|
|
134
135
|
* @returns {Promise<import('mongodb').Collection<WithId<T>>>}
|
|
135
136
|
*/
|
|
136
|
-
protected _getCollection(forRead?: boolean): Promise<import("mongodb").Collection<WithId<T>>>;
|
|
137
|
+
protected _getCollection(forRead?: boolean, forceIndexAwait?: boolean): Promise<import("mongodb").Collection<WithId<T>>>;
|
|
137
138
|
/**
|
|
138
139
|
*
|
|
139
140
|
* @param {object[]} indexes
|