I am trying to search couchdb with nano, as described here:
https://github.com/dscape/nano#dbsearchdesignname-searchname-params-callback
But I get 'document is missing attachment'.
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);
}
})
EDIT this is my view code:
function (doc) {
if(doc.type && doc.type==='message') {
emit(doc.text.toLowerCase(), 1);
}
}