title: How to search with couchdb nano
body: <p>I am trying to search couchdb with nano, as described here:</p>
  
  <p><a href="https://github.com/dscape/nano#dbsearchdesignname-searchname-params-callback" rel="nofollow noreferrer">https://github.com/dscape/nano#dbsearchdesignname-searchname-params-callback</a></p>
  
  <p>But I get 'document is missing attachment'.</p>
  
  <pre><code>var config = require('./config.js');
  var nano = require('nano')(config.dbhost);
  
  var couch = nano.db.use('my-database');
  
  couch.search('object-views', 'by-content', {q: 'hello'}, function(err, data) {
      if(err) {
          console.log('ERROR ', err);
      } else {
          console.log(data);
      }
  })
  </code></pre>
  
  <p>EDIT this is my view code:</p>
  
  <pre><code>function (doc) {
    if(doc.type &amp;&amp; doc.type==='message') {
      emit(doc.text.toLowerCase(), 1);
    }
  }
  </code></pre>