Sync function to reject conflict

Hi,

I want to write a sync function and so if the new document pushed is creating conflict then I would like to reject that document.
I know this will be supported in 1.5 but right now we are using 1.4.1 and I don’t care for the data loss because it will be purely for dev environment. We do data reset by flushing the bucket and then push the same data (when it was inserted for first time).

Now if a dev push old data because he had old build running then all documents gets conflict and it become very cumbersome to correct data again. Is it possible to do so by Sync gateway sync function. If yes then please let me know.

Regards
Pankaj Sharma

You probably want to stream line your D2P process(Development to Production) with specific users and passwords.
You also want to audit and track your documents. I think if you put the version of the App that made/change the documents it would be easier to find the docs you want changed.
{
“_id”:“foo”,
“audit”:{
“createdBy”:“bob”,
“createdDT”:“2016-08-17 15:35:57”,
“createdVer”:“0.74”,
“updatedBy”:“time”,
“updatedDT”:“2016-09-11 09:10:27”,
“updatedVer”:“0.80”
}

}

Auditing is already there the point is , currently we don’t have integration with RDBMS system so we do populate the data manually. And once the data is corrupt (as described above) its an effort of 30 mins minimum to correct it and that also an issue because if any app have an older build again it will ruin the effort. Hence I want to block all conflicting documents to be inserted on the server.

For this the best thing which I see is the sync gateway. If you can provide a code snippet for the same then it will be very helpfull for me.

Regards
Pankaj Sharma

I think your ask is “how do I force SG not to take branches from XYZ devices?”
CBL is the one thats doing the POST bulk_docs call. Sync gateway just authenticates the security policy(i.e. sync function) and write policy of the documents.
CBL wants to tell everybody about the branch that it has even though you don’t want to CBL to tell people.

So a question would be;
1.“How do we prevent CBL from sending the bad/old brand?”
2.“How can we resolve the conflict of the bad/old branch before the push?”

It means we can not do it on the sync gateway. Because it wont stop any data to go through. No issue. I have to do it on the server so I would like to do it some other way. Thanks @househippo