daleharvey/pouchdb — pull request #1734 by nolanlawson (2014-03-25 22:29:42+00:00)
Title: (#1734) - WIP - simultaneous writes

Sadly this test fails in Node. Without transactions, I'm guessing the only solution is task queues, which will unfortunately not work unless we tie them to db names rather than PouchDB instances.

```js
it('handles simultaneous writes', function (done) {
var db = new PouchDB(dbs.name);
var id = 'fooId';
var errorNames = [];
var ids = [];
var numDone = 0;
function callback(err, res) {
should.not.exist(err);
if (res[0].error) {
errorNames.push(res[0].name);
} else {
ids.push(res[0].id);
}
console.log(res);
if (++numDone === 2) {
errorNames.should.deep.equal(['conflict']);
ids.should.deep.equal([id]);
done();
}
}
db.bulkDocs({docs : [{_id : id}]}, callback);
db.bulkDocs({docs : [{_id : id}]}, callback);
});
```