diff --git a/pouchdb-core/pouchdb-core-tests.ts b/pouchdb-core/pouchdb-core-tests.ts index b46bce834d..3da5e929b7 100644 --- a/pouchdb-core/pouchdb-core-tests.ts +++ b/pouchdb-core/pouchdb-core-tests.ts @@ -38,6 +38,23 @@ namespace PouchDBCoreTests { }); } + function testBulkDocs() { + const db = new PouchDB(); + type MyModel = { property: 'someProperty '}; + let model: PouchDB.Core.Document; + let model2: PouchDB.Core.Document; + + db.bulkDocs([model, model2]).then((result) => { + result.forEach(({ ok, id, rev }) => { + isString(id); + isString(rev); + }); + }); + + db.bulkDocs([model, model2], null, (error, response) => { + }); + } + function testCompact() { const db = new PouchDB<{}>(); // Promise version diff --git a/pouchdb-core/pouchdb-core.d.ts b/pouchdb-core/pouchdb-core.d.ts index b0498e76af..cdd078f54f 100644 --- a/pouchdb-core/pouchdb-core.d.ts +++ b/pouchdb-core/pouchdb-core.d.ts @@ -268,6 +268,12 @@ declare namespace PouchDB { allDocs(options?: Core.AllDocsOptions): Promise>; + bulkDocs(docs: Core.Document[], + options: Core.PutOptions | void, + callback: Core.Callback): void; + bulkDocs(docs: Core.Document[], + options?: Core.PutOptions): Promise; + /** Compact the database */ compact(options?: Core.CompactOptions): Promise; compact(options: Core.CompactOptions,