gypsum
Version:
Simple and easy lightweight typescript server side framework on Node.js.
27 lines (26 loc) • 1.4 kB
TypeScript
import * as Validall from 'validall';
import * as MongoDB from 'mongodb';
import { Model } from './model';
import { IResponse } from '../types';
import { Context } from '../context';
import { App } from '../app';
export declare class MongoModel extends Model {
protected collection: MongoDB.Collection;
protected omits: string[];
protected schema: Validall.Schema;
constructor(app: App);
protected onCollection(): void;
count(query?: any, options?: any, ctx?: Context): Promise<IResponse>;
find(query?: any, options?: any, ctx?: Context): Promise<IResponse>;
findOne(query: any, options?: any, ctx?: Context): Promise<IResponse>;
findById(id: string, options?: any, ctx?: Context): Promise<IResponse>;
insert(documents: any, writeConcern?: any, ctx?: Context): Promise<IResponse>;
insertOne(document: any, ctx?: Context): Promise<IResponse>;
search(query?: any, options?: any, ctx?: Context): Promise<IResponse>;
update(filter: any, update: any, ctx?: Context): Promise<IResponse>;
updateOne(filter: any, update: any, ctx?: Context): Promise<IResponse>;
updateById(id: string, update: any, ctx?: Context): Promise<IResponse>;
delete(filter: any, ctx?: Context): Promise<IResponse>;
deleteOne(filter: any, ctx?: Context): Promise<IResponse>;
deleteById(id: string, ctx?: Context): Promise<IResponse>;
}