@joktec/mongo
Version:
JokTec - Mongo Service
17 lines • 1.01 kB
TypeScript
import { Dictionary, ICondition, IPopulate, ISort } from '@joktec/core';
import { Ref } from '@typegoose/typegoose';
import { PopulateOptions, RefType } from 'mongoose';
import { IMongoRequest, MongoSchema, ObjectId } from '../models';
export declare class MongoHelper {
static flatten(obj: Dictionary, omitKeys?: string[]): Dictionary;
static parsePagination(query?: IMongoRequest<any>): {
limit?: number;
offset?: number;
};
static parseProjection(select: string | string[] | Record<string, number | boolean | object>): Record<string, 1 | 0>;
static parseSort(sort: ISort<any>): Record<string, 1 | -1>;
static parseFilter(condition: ICondition<any>, flat?: boolean): ICondition<any>;
static parsePopulate<T extends MongoSchema>(populate?: IPopulate<T>): PopulateOptions[];
static parseSimpleCondition<T extends MongoSchema, ID extends RefType = string>(cond: ID | ObjectId | Ref<T, ID> | ICondition<T>): ICondition<T>;
}
//# sourceMappingURL=mongo.helper.d.ts.map