| 368 | public exec(throwIfMissing: true): Promise<RxDocument<RxDocType, OrmMethods, Reactivity>>; |
| 369 | public exec(): Promise<RxQueryResult>; |
| 370 | public async exec(throwIfMissing?: boolean): Promise<any> { |
| 371 | if (throwIfMissing && this.op !== 'findOne') { |
| 372 | throw newRxError('QU9', { |
| 373 | collection: this.collection.name, |
| 374 | query: this.mangoQuery, |
| 375 | op: this.op |
| 376 | }); |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * run _ensureEqual() here, |
| 381 | * this will make sure that errors in the query which throw inside of the RxStorage, |
| 382 | * will be thrown at this execution context and not in the background. |
| 383 | */ |
| 384 | await _ensureEqual(this as any); |
| 385 | const useResult = ensureNotFalsy(this._result); |
| 386 | return useResult.getValue(throwIfMissing); |
| 387 | } |
| 388 | |
| 389 | |
| 390 | |