MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / streamVirtual

Method streamVirtual

packages/mongodb/src/MongoDriver.ts:282–299  ·  view source on GitHub ↗
(
    entityName: EntityName<T>,
    where: FilterQuery<T>,
    options: FindOptions<T, any, any, any>,
  )

Source from the content-addressed store, hash-verified

280 }
281
282 async *streamVirtual<T extends object>(
283 entityName: EntityName<T>,
284 where: FilterQuery<T>,
285 options: FindOptions<T, any, any, any>,
286 ): AsyncIterableIterator<EntityData<T>> {
287 const meta = this.metadata.find(entityName)!;
288
289 if (meta.expression instanceof Function) {
290 const em = this.createEntityManager();
291 const stream = await meta.expression(em, where as any, options, true);
292 yield* stream as EntityData<T>[];
293
294 return;
295 }
296
297 /* v8 ignore next */
298 return super.findVirtual(entityName, where, options);
299 }
300
301 async count<T extends object>(
302 entityName: EntityName<T>,

Callers 1

streamMethod · 0.95

Calls 3

createEntityManagerMethod · 0.95
findMethod · 0.65
findVirtualMethod · 0.65

Tested by

no test coverage detected