import { ObjectId } from 'mongodb'; import { ModelUpdateOptions, Schema, SchemaOptions } from 'mongoose'; import { BaseDocument, UpdateResult } from './base.type'; import { DataDocument } from './method.type'; import { MongodbOperationImplements } from './mongodb.interface'; export declare function autoDetect(target: DataModel, propertyKey: 'collectionName'): void; export interface DataModelArgs { connectionName: string; } /** * @singleton : every class name is a singleton, multiple new will return same instance. */ export declare abstract class DataModel extends MongodbOperationImplements { private readonly _realConnectionName; protected displayTitle: string; protected readonly schemaOptions: Partial; constructor({connectionName}?: Partial); getInstance(idObj: ObjectId | string | DataDocument): Promise>; upsert(conditions: Object, doc: Object, options?: ModelUpdateOptions): Promise; protected create(): DataDocument; /** only for overwrite */ protected initialization(): void; protected insert(content: IDocType): Promise>; protected remove(doc: any): Promise; /** * only for overwrite, no content * @param {"mongoose".Schema} schemaObject */ protected schemaHook(schemaObject: Schema): void; private _namespace; readonly namespace: string; private readonly realConnectionName; }