我收集了以下内容:
{
"_id" : ObjectId("51dfb7abe4b02f15ee93a7c7"),
"date_created" : "2013-7-12 13:25:5",
"referrer_id" : 13,
"role_name" : "Physician",
"status_id" : "1",
"demographics" : {
"date_created" : "2013-7-12 13:25:5",
"first_name" : "jjjjkk",
"last_name" : "jjjjkkjjjjkkjjjjkk",
"birthdate" : "11-07-1980"
}
}
我正在创建以下Map函数:
"map" : "function map(){emit(this._id,{demographics:{first_name\":this.demographics.first_name,middle_name\":this.demographics.middle_name,last_name\":this.demographics.last_name}});"
根据文件, 但我收到了错误
"errmsg" : "exception: couldn't compile code for: `_map`"
答案 0 :(得分:0)
请尝试:
var map = function(){
emit(this._id, {
demographics:{
first_name: this.demographics.first_name,
middle_name: this.demographics.middle_name,
last_name: this.demographics.last_name
}
});
}
内联:
var map = function(){emit(this._id, {demographics:{first_name: this.demographics.first_name, middle_name: this.demographics.middle_name, last_name: this.demographics.last_name } }); }