Hello,
Since CouchDB provides validate_doc_update, I thought that I might be able to
provide some to check duplication here..
like...
function(newDoc,oldDoc,userCtx) {
if(newDoc.type == "myCustomType") {
// here..something like..
// check newDoc against the existing documents of "myCustomType"
to see whether there was already same data or not..
// for example,
//
getExistingDocumentsByType("myCustomType").forEach(function(doc) {
// if(newDoc.mydata == doc.mydata) {
// ///Boom..throw error..
// }
// });
//
Is this something possible? Well..obviously there is no provided
getExistingDocumentsByType function from couchdb.....just was trying to show
what I was trying to achieve...
So ultimately, my question is that..is there any way I can somehow access the
existing documents from validate_doc_update function?
Thanks,