Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with _design/feathers view #3

Open
jay-jlm opened this issue May 16, 2017 · 2 comments
Open

Problem with _design/feathers view #3

jay-jlm opened this issue May 16, 2017 · 2 comments

Comments

@jay-jlm
Copy link

jay-jlm commented May 16, 2017

Sometimes it creates some temporary view and starts giving out this error like it cannot delete it, this both in local couchdb, not just on Bluemix, not even removing the view and restarting the server can make this go away

/Users/joao/node_projects/proto-server/node_modules/cradle/lib/cradle.js:244 callback(null, self.options.raw ? body : new cradle.Response(body, res)); ^ TypeError: Cannot read property 'rev' of undefined at /Users/joao/node_projects/proto-server/node_modules/feathers-couchdb/lib/index.js:230:70 at Request._onResponse [as _callback] (/Users/joao/node_projects/proto-server/node_modules/cradle/lib/cradle.js:244:9) at Request.self.callback (/Users/joao/node_projects/proto-server/node_modules/request/request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:194:7) at Request.<anonymous> (/Users/joao/node_projects/proto-server/node_modules/request/request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:191:7) at IncomingMessage.<anonymous> (/Users/joao/node_projects/proto-server/node_modules/request/request.js:1091:12) at Object.onceWrapper (events.js:293:19)

@jay-jlm
Copy link
Author

jay-jlm commented May 16, 2017

When logging the state after this line:

function (err, obj) { db.view('feathers/temp', opts, function (err, res) {

the first err is null but value of obj is undefined... is this expected behavior??

@liquidcowgithub
Copy link

In case anyone else comes across this issue;
The trick is to create an appropriate design view (as per this package's readme/docs).

In context of a feathers service, you can get started by creating a design doc:

service.create({ "_id": "_design/things", "views": { "all": { "map": "function (doc/*``*/) {if (doc && doc.myFilterProperty == true) {emit(null, doc);}}" } } })

and then any time you query via the feathers service:

service('things').find({ query: { q: "things/all", ... } });

More importantly, it doesn't look like this package is maintained? So maybe stay away, or use cradle directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants