MCPcopy
hub / github.com/pubkey/rxdb / exec

Method exec

src/rx-query.ts:370–387  ·  view source on GitHub ↗
(throwIfMissing?: boolean)

Source from the content-addressed store, hash-verified

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

Calls 4

newRxErrorFunction · 0.90
ensureNotFalsyFunction · 0.90
_ensureEqualFunction · 0.85
getValueMethod · 0.80

Tested by 6

testCorrectQueriesFunction · 0.64
getJsonFunction · 0.64
getDocIdsFunction · 0.64
updateDocFunction · 0.64
ensureUpdatedFunction · 0.64