我有一个名为:'sample' 的数据库
我有 _design 文档,看起来像:
{ "_id": "_design/orgFilter",
"_rev":"9-7cd70d5ca52ddd42a3ff953c01d7cd36",
"views": {
"newView": {
"map": "function(doc) {
if(doc.type && doc.type==='organization' ){
emit(doc._id, doc.name);
}
}"
}
},
"language": "javascript"
}
示例数据如下:
{ "_id": "eb425729d084d49c8cddd45c6e00b07f", "_rev":
"2-9035a8eb3fa0fef44b0927bbe7090bbd", "type": "organization",
"name": "org1" }
{ "_id": "eb425729d084d49c8cddd45c6e00b2a7", "_rev":
"3-cf39cb747db01a4a71e58c2211de7c04", "type": "organization",
"name": "org2" }
{ "_id": "eb425729d084d49c8cddd45c6e00bf37", "_rev":
"3-d263492888a5755e91788901e59756ad", "type": "organization",
"name": "org3" }
在我的节点服务器中,我使用 nano db 并尝试将他的复制功能与 filter 一起使用,它看起来像:
nano.db.replicate('sample','http://localhost:5984/'+'b_rep',
{create_target: true,continuous:true,filter:"orgFilter/newView"} , function (err, body) {
if (!err)
console.log(body);
});
此操作的响应是:“缺少 json 键:newView”
我应该怎么做才能使这个过滤器复制?
谢谢