(
entityName: EntityName<Entity>,
where: FilterQuery<NoInfer<Entity>>,
options: FindOptions<Entity, Hint, Fields, Excludes> = {},
)
| 829 | ): Promise<[Loaded<Entity, Hint, Fields, Excludes>[], number]>; |
| 830 | |
| 831 | async findAndCount< |
| 832 | Entity extends object, |
| 833 | Hint extends string = never, |
| 834 | Fields extends string = never, |
| 835 | Excludes extends string = never, |
| 836 | >( |
| 837 | entityName: EntityName<Entity>, |
| 838 | where: FilterQuery<NoInfer<Entity>>, |
| 839 | options: FindOptions<Entity, Hint, Fields, Excludes> = {}, |
| 840 | ): Promise<[Loaded<Entity, Hint, Fields, Excludes>[], number]> { |
| 841 | const em = this.getContext(false); |
| 842 | await em.tryFlush(entityName, options); |
| 843 | options.flushMode = 'commit'; // do not try to auto flush again |
| 844 | |
| 845 | return Promise.all([ |
| 846 | em.find(entityName, where as any, options), |
| 847 | em.count(entityName, where, options as CountOptions<Entity, Hint>), |
| 848 | ]); |
| 849 | } |
| 850 | |
| 851 | /** |
| 852 | * Calls `em.find()` and `em.count()` with the same arguments (where applicable) and returns the results as {@apilink Cursor} object. |
no test coverage detected