I'm using phonegap with Android and I'm having an issue where I insert a document in my local database and the document already exists in the sync gateway by another user. The sync gateway doesn't pull the document because the user is not the owner of the document. The changes feed on the client that created the conflicting document doesn't get reported of the conflict or deletion, even if I do a get on the local document in the changes feed everything looks normal. If I log out (local db gets deleted) and log back in (sync with gateway) the document isn't there because the sync gateway ignored the revision.
How can I notify the user of the conflicting document, and resolve it through the client ?
This is what I use to check for a conflict on the document.
//get the document to see if there was a conflict.
if( typeof change.doc._rev != 'undefined' )
config.db.get([change.doc._id, { "rev":change.doc._rev, "conflicts": true, "deleted_conflicts" : true } ], function(error, doc) {
if(error) { return log ("Error getting revision:" + JSON.stringify( error ) ) }
log( "Changed Document" + JSON.stringify( doc ) )
} )
is there a way to detect when the replication has finished doing the _bulk_docs post for changes in the local db ?