How do we use CouchDB's _bulk_docs with all_or_nothing option?
couchdb, pouchdb, transactions
Solution
My usage was correct. However, there are more than one reason why my attempts are failed:
PouchDB-server simply ignores (even without a proper error) `all_or_nothing` as they do believe this is the correct way.
Cloudant simply drops this feature as they keep their database service distributed and transaction thing does not let the database scale.
CouchDB dropped `all_or_nothing` support in 2.0 version.
Problem
In the CouchDB documentation they say we can insert documents in bulk, with `all_or_nothing` or `new_edits` option if we want to. But it seems, `all_or_nothing` key does not have any effects when we use like so: ``` HOST="http://test:test@localhost:5984/mydb" curl -vX POST "$HOST/_bulk_docs" \ -H "Content-type: application/json" \ -d @test.json ``` with a test.json: ``` { "all_or_nothing":true, "docs":[ {"_id":"hello"}, {"_id":"world"} ] } ``` This inserts documents which have `hello` and `world` ids. Re-running the script by replacing `hello` with `hello1` should cause `hello1` to be inserted in the database but fail the `world` document's recording (since it doesn't have correct `_rev`), thus they both SHOULD fail because we said `all_or_nothing`. But in the end, there are 3 documents in the database: `hello`, `hello1` and `world`. How do we use `all_or_nothing` with CouchDB?