couchdb map function gives compilation_error
<p>Am new to couchdb2.0,working on map function.I have written a function</p>

<pre><code>function(doc) {
  if(doc.entityType!=null){
     if(doc.cityName!=null &amp;&amp; doc.locationName!=null){

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

     emit(key, doc);
    }
  }
}
</code></pre>

<p>which is throwing</p>

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

<p>Please help me out.</p>