Danwakeem
Danwakeem

Reputation: 348

CouchDB bulk delete Node.js

I am using the Cloudant node module to modify my Cloudant database. I am sending the following documents to the db.bulk(params,callback) function.

{ docs: [
   { "_id": "...",
     "_rev": "...",
    "_deleted": true
   },
   { "_id": "...",
     "_rev": "...",
    "_deleted": true
   },
   { "_id": "...",
     "_rev": "...",
    "_deleted": true
   },
   { ... }   
]}

After I call this function I do not get any errors but when I try and query the database later I am still getting the deleted documents back? I know that Cloudant has "tombstone documents" so they should still be there but I don't really see tombstones at all I just see the documents I wanted to delete sitting in my database with a new _rev number and returned as if they are still active.

Even when I try to query the database with a selector deleted: true I get nothing back.

Am I missing something?

P.S If you are wondering why I put "_deleted" in the bulk document I was just following what this site said to do.

Upvotes: 0

Views: 1125

Answers (1)

OrangeDog
OrangeDog

Reputation: 38749

In a bulk operation, some changes may fail while others succeed.

You need to check the actual response for each update rather than just the err parameter. Even if err is null, it may be the case that every update failed for an individual reason, for example a revision conflict.

Upvotes: 1

Related Questions