@point-hub/papi
Version:
Point API Framework
36 lines • 1.14 kB
TypeScript
import { IDatabase } from '../../index';
/**
* https://www.mongodb.com/docs/drivers/node/current/fundamentals/indexes/
* https://www.mongodb.com/docs/manual/reference/collation/
* https://www.mongodb.com/docs/manual/core/index-sparse/
* https://www.mongodb.com/docs/manual/core/index-partial/
*/
export declare class MongoDBHelper {
private db;
constructor(db: IDatabase);
/**
* Create unique column
*
* @example
* create unique attribute "name"
* createUnique(collection, {
* name: -1,
* })
*
* @example
* create unique attribute for multiple column "first_name" and "last_name"
* createUnique(collection, {
* firstName: -1,
* lastName: -1,
* })
*/
createUnique(collection: string, properties: object): Promise<void>;
/**
* Create unique if column is exists
*/
createUniqueIfNotNull(collection: string, properties: object): Promise<void>;
isExists(name: string): Promise<boolean>;
static stringToObjectId(val: any): any;
static objectIdToString(val: any): any;
}
//# sourceMappingURL=mongodb-helper.d.ts.map