2016-09-12 16:14:01 +00:00
|
|
|
/// <reference types="q" />
|
2016-09-11 16:01:46 +00:00
|
|
|
import * as plugins from './smartdata.plugins';
|
|
|
|
import { DbConnection } from './smartdata.classes.dbconnection';
|
|
|
|
export declare class DbCollection<T> {
|
|
|
|
collection: plugins.mongodb.Collection;
|
|
|
|
constructor(nameArg: string, dbConnectionArg: DbConnection);
|
|
|
|
/**
|
|
|
|
* adds a validation function that all newly inserted and updated objects have to pass
|
|
|
|
*/
|
2016-09-12 15:31:23 +00:00
|
|
|
addObjectValidation(funcArg: any): void;
|
2016-09-11 16:01:46 +00:00
|
|
|
/**
|
2016-09-12 15:31:23 +00:00
|
|
|
* finds an object in the DbCollection
|
2016-09-11 16:01:46 +00:00
|
|
|
*/
|
2016-09-12 20:11:17 +00:00
|
|
|
find(docMatchArg: T | any): plugins.q.Promise<T[]>;
|
2016-09-12 15:31:23 +00:00
|
|
|
/**
|
|
|
|
* inserts object into the DbCollection
|
|
|
|
*/
|
2016-09-12 16:14:01 +00:00
|
|
|
insertOne(docArg: T): plugins.q.Promise<void>;
|
2016-09-11 16:01:46 +00:00
|
|
|
/**
|
|
|
|
* inserts many objects at once into the DbCollection
|
|
|
|
*/
|
2016-09-12 16:14:01 +00:00
|
|
|
insertMany(docArrayArg: T[]): plugins.q.Promise<void>;
|
|
|
|
private checkDoc(doc);
|
2016-09-11 16:01:46 +00:00
|
|
|
}
|