UNPKG

@scalars/grapi-mongodb

Version:

The mongodb package of Grapi

21 lines (20 loc) 1.24 kB
import { Mutation, Operator, OrderBy, RelationWhere, Where } from '@scalars/grapi'; import { Db, FilterQuery } from 'mongodb'; export declare class MongodbData { readonly db: Db; readonly collectionName: string; constructor(db: Db, collectionName: string); findInCollection(filterQuery: FilterQuery<any>, orderBy?: {}): Promise<any[]>; findRecursive(where: Record<string, any>, orderBy: OrderBy, data?: any[]): Promise<any[]>; executeRelationFilters(where: Record<string, RelationWhere>, data: any[], filtered?: any[]): Promise<any[]>; findOneRelation(colectionName: string, where: Where): Promise<any>; findManyRelation(foreignKey: string, foreignId: string, collectionName: string, where: Where): Promise<any[]>; filterManyFromManyRelation(sourceSideName: string, targetSideName: string, sourceSideId: string, collection: string, where: Record<string, any>): Promise<any[]>; whereToFilterQuery(where: Where, operator?: Operator): FilterQuery<Record<string, any>>; findRecursiveOperator(where: Where): { operator?: Operator; filters?: any; }; transformMutation: (mutation: Mutation, set?: boolean) => Record<string, any>; handleMongoDbError(error: any): void; }