codeswarm / sails-couchdb-orm

CouchDB Adapter for the Sails.js ORM Framework, Waterline
36 stars 20 forks source link

delete problem #25

Open SergioReis97 opened 7 years ago

SergioReis97 commented 7 years ago

Hi, i'm new to sails/couchdb so it might be just a really noob mistake, but I partially can't get this package to work with the default sails blueprint.

I've successfully inserted and read from the database and everything works as it should. Now, when I try to delete i always get the following errors

": You tried to DELETE a database with a ?rev= parameter. Did you mean to DELETE a document instead? at Request._callback (.../node_modules/nano/nano.js:319:39) at Request.self.callback (.../node_modules/request/request.js:122:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (.../node_modules/nano/node_modules/request/request.js:888:14) at emitOne (events.js:101:20) at Request.emit (events.js:188:7) at IncomingMessage. (.../node_modules/nano/node_modules/request/request.js:839:12) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickDomainCallback (internal/process/next_tick.js:128:9)"

Delete code i'm using : io.socket.delete("/user", user, function (data, jwres){ console.log(data); console.log(jwres); }); Playing with postman, i managed to delete using the link http://localhost:5984/user/one_id_from_db&rev=one_revision_id_from_db and it worked, to reproduce the error I've eventually did a http://localhost:5984/user?id=same_id&rev=same_revision and sure enough {"error":"bad_request","reason":"You tried to DELETE a database with a ?rev= parameter. Did you mean to DELETE a document instead?"}

Is it possible that the blueprints are sending id as a normal parameter and not just as /id?rev=...

Thank you for your time