2016-11-29 104 views
1

是新来couchdb2.0,在地图上function.I工作已经写了一个功能CouchDB的地图功能给compilation_error

function(doc) { 
    if(doc.entityType!=null){ 
    if(doc.cityName!=null && doc.locationName!=null){ 

    var key =[doc.cityName,doc.locationName,doc.entityType] 

    emit(key, doc); 
    } 
    } 
} 

它扔

{ “错误”:“compilation_error “,”reason“:”表达式不会评估函数。>>(function(doc){\ n if(doc.cityName!= null & & doc.entityType!= null){key = >> [doc。 cityName,doc.entityType] emit(key,doc); \ n}})“}

请帮帮我。

回答

0

分号添加到key变量实例的端部:

var key =[doc.cityName,doc.locationName,doc.entityType];