UNPKG

1.13 kBTypeScriptView Raw
1import { Database } from '../database';
2import { SeederCollection, LogFn } from '../common';
3import { CollectionInsertManyOptions } from 'mongodb';
4/**
5 * Allows to import collections into database.
6 */
7export declare class CollectionImporter {
8 /**
9 * Wrapper for MongoDB database
10 */
11 db: Database;
12 /**
13 * Logger instance
14 */
15 log: LogFn;
16 /**
17 * Optional MongoDB collection import options
18 */
19 collectionInsertManyOptions?: CollectionInsertManyOptions;
20 /**
21 * Constructs new `CollectionImporter` instance.
22 *
23 * @param db Database object
24 * @param collectionInsertManyOptions Optional MongoDB Collection InsertMany Options
25 */
26 constructor(db: Database, collectionInsertManyOptions?: CollectionInsertManyOptions, log?: LogFn);
27 /**
28 * Imports multiple collections into database.
29 *
30 * @param collections Array of collections
31 */
32 import(collections: SeederCollection[]): Promise<void>;
33 /**
34 * Imports single collection into database.
35 *
36 * @param collection Collection definition
37 */
38 private importCollection;
39}