Reputation: 651
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);
}
}
Upvotes: 1
Views: 781
Reputation: 3690
So I looked inside nano code and found that the search is designed for Cloudant only. It calls a view of type "search".
So instead of calling _designdoc/name/_view/something
, it calls:
_designdoc/name/_search/something
So basically, use db.view
Upvotes: 1