From 92eab53843bf89db14f55dc02950fe073305f6a1 Mon Sep 17 00:00:00 2001 From: Ben Rudolph Date: Sun, 24 Mar 2013 05:46:35 -0700 Subject: [PATCH] Update docs for new async pouch creation --- docs/api.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/docs/api.md b/docs/api.md index b3f398b576..d1c36733cb 100644 --- a/docs/api.md +++ b/docs/api.md @@ -43,17 +43,14 @@ Retrieves all databases from PouchDB. ## Create a database - Pouch('dbname', [options], [callback]) - Pouch('http://localhost:5984/dbname', [options], [callback]) + var pouchdb = Pouch('dbname', [options]) + var pouchdb = Pouch('http://localhost:5984/dbname', [options]) This method gets an existing database if one exists or creates a new one if one does not exist. You may also explicitly specify which backend you want to use for local database (e.g. `idb://dbname` or `leveldb://dbname`) but usually it is convenient to let PouchDB choose the best backend by itself. - var pouchdb; - Pouch('test', function(err, db) { - pouchdb = db; - // Use pouchdb to call further functions - pouchdb.post(.... - }) + var pouchdb = Pouch('test'); + + pouchdb.post(...; ## Delete a database @@ -243,7 +240,7 @@ Fetch multiple documents, deleted document are only included if `options.keys` i * `options.keys`: array of keys you want to get - neither `startkey` nor `endkey` can be specified with this option - the rows are returned in the same order as the supplied "keys" array - - the row for a deleted document will have the revision ID of the deletion, and an extra key "deleted":true in the "value" property + - the row for a deleted document will have the revision ID of the deletion, and an extra key "deleted":true in the "value" property - the row for a nonexistent document will just contain an "error" property with the value "not_found" * `options.attachments`: Include attachment data @@ -415,7 +412,7 @@ If `options.continuous` is set it returns object with one method `cancel` which * `options.since`: Start the results from the change immediately after the given sequence number * `options.complete`: Function called when all changes have been processed * `options.continuous`: Use _longpoll_ feed -* `options.onChange`: Function called on each change after deduplication (only sends the most recent for each document), not called as a callback but called as onChange(change). Use with `continuous` flag. If you want to +* `options.onChange`: Function called on each change after deduplication (only sends the most recent for each document), not called as a callback but called as onChange(change). Use with `continuous` flag. If you want to @@ -506,7 +503,7 @@ Replicate one database to another. db.revsDiff(diff, [callback]) -Given a set of document/revision IDs, returns the subset of those that do not correspond +Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database. Primarily used in replication. db.revsDiff({