Closed subpop closed 13 years ago
More on this. I played around with versions, and found that mongodb-rest@0.6.4 won't work with connect@0.5.4 & express@1.0.1, but mongodb-rest@0.6.3 does. Hope this helps.
Thanks for reporting. Have fixed this in master, not yet published a new npm package for this.
Hi, I had the same problem here, with express 2 beta and mongo driver 0.9.1, so I made two changes that solved it, it was easy to find on google. 1) first I changed lines 29 and 30 in server.js : app.use(express.bodyParser()); app.use(express.static(__dirname + '/public')); So it fits the new express methods name. 2) I then changed the code in rest.js inspired by this post: http://stackoverflow.com/questions/4902569/node-js-mongodb-select-document-by-id-node-mongodb-native So retrieving documents by their _ids works. I don't know if it's the best way to solve it, it's the only one I found. I agree it's not a good idea to work with alpha and beta software for a noob like me. Anyway great job, I've been looking for that kind of simple rest interface for a very long time
I'm getting an error from middleware/router.js. I start up the server, and send a GET /db/collection/id request. The error response is:
SyntaxError: Unexpected token ILLEGAL at Object.parse (native) at Object. (/usr/local/lib/node/.npm/mongodb-rest/0.6.4/package/lib/rest.js:18:20)
at param (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/middleware/router.js:145:21)
at param (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/middleware/router.js:156:15)
at param (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/middleware/router.js:156:15)
at param (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/middleware/router.js:156:15)
at pass (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/middleware/router.js:161:10)
at Object.router as handle
at next (/usr/local/lib/node/.npm/connect/0.5.3/package/lib/connect/index.js:236:15)
at Object.logger as handle
Using express 1.0.1, node 0.2.6, mongodb 1.6.5, mongodb-rest 0.6.4, mongodb node driver 0.7.9. All software (except node and mongodb) installed using npm.