1

Am new to couchdb2.0,working on map function.I have written a function

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

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

     emit(key, doc);
    }
  }
}

which is throwing

{"error":"compilation_error","reason":"Expression does not eval to a function. >>(function(doc) {\n if(doc.cityName!=null && doc.entityType!=null){key=>>[doc.cityName,doc.entityType] emit(key, doc);\n}})"}

Please help me out.

ste-fu
  • 6,879
  • 3
  • 27
  • 46

1 Answers1

0

Add a semicolon to the end of the key variable instantiation:

var key =[doc.cityName,doc.locationName,doc.entityType];
Andy Lamb
  • 2,151
  • 20
  • 22