Skip to content
Snippets Groups Projects
Commit 44991d48 authored by wactbprot's avatar wactbprot
Browse files

add Class key in cobs

parent b5b96ce4
No related branches found
No related tags found
No related merge requests found
library("R4CouchDB")
## in
cin <- cdbIni()
cin$DBName <- "vl_db_work"
cin$view <- "cob"
cin$design <- "new"
## out
cout <- cdbIni()
cout$DBName <- "vldb-test"
docs <- cdbGetView(cin)$res$rows
N <- length(docs)
for(i in 1:N){
cout$id <- docs[i][[1]]$value[["_id"]]
cout$dataList <- docs[i][[1]]$value
cdbUpdateDoc(cout)$res
}
\ No newline at end of file
function(doc) {
if(doc && doc.CalibrationObject){
var ida = doc._id.split("-");
if(ida[0] == "cob"){
var ndoc = JSON.parse(JSON.stringify(doc))
ndoc.CalibrationObject.Class = ida[1].toUpperCase();
emit(null, ndoc);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment