Answer the question
In order to leave comments, you need to log in
CouchDB: Frequent Update
Good evening, Khabrovites. I'm trying to attach
CouchDB to one of our projects and, in principle, I'm very pleased with everything.
I really like the fact that 100 million records, on a modest 8 Cores x 32GB RAM server, turn over without problems.
But there is one small detail
{
"_id": "_design/funcs",
"updates": {
"addUid": "function(doc,req) {
if(doc!==null) {
req.body=JSON.parse(req.body);
var uids=req.body.uids;
for(var uid in uids) {
uid=uids[uid];
doc.uids[uid] = true
}
delete doc._rev
}
return[doc,JSON.stringify(doc)]
}"
}
}
Answer the question
In order to leave comments, you need to log in
I could be wrong, but first, every time you update a document, a new version of it is created. This means that when the id is added, there will be a new version of the document. Due to frequent additions, the B+ tree of records can be rebuilt, which can affect the performance
. By the way, did I understand correctly that the id is updated in objects belonging to the same document? It may also be that once you write down the id thread to someone, you are trying to refer to an even old document in a cycle.
and how it is necessary to handle the "Document update conflict" exception correctly? In a loop, get a new version of the document, apply changes to it, and then repeat?
wouldn't there be an infinite loop here?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question