MCPcopy
hub / github.com/ever-co/ever-demand / find

Function find

packages/core/src/@pyro/db-server/db-service.ts:302–331  ·  view source on GitHub ↗
(conditions: FindObject<RawObject<T>>)

Source from the content-addressed store, hash-verified

300 }
301
302 async find(conditions: FindObject<RawObject<T>>): Promise<T[]> {
303 const callId = uuid();
304
305 this.log.info({ callId, conditions }, '.find(conditions) called');
306
307 let results: T[];
308
309 try {
310 const documents = (await this.Model.find(
311 conditions == null ? {} : conditions
312 )
313 .lean()
314 .exec()) as RawObject<T>[];
315
316 results = _.map(documents, (obj) => this.parse(obj));
317 } catch (err) {
318 this.log.error(
319 { callId, conditions, err },
320 '.find(conditions) thrown error!'
321 );
322 throw err;
323 }
324
325 this.log.info(
326 { callId, conditions, results },
327 '.find(conditions) found results'
328 );
329
330 return results;
331 }
332
333 async findOne(conditions: FindObject<RawObject<T>>): Promise<T> {
334 const callId = uuid();

Callers 1

Calls 3

execMethod · 0.80
findMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected