ltonetwork / mongodb-rest

JSON REST server for MongoDB (using node.js)
MIT License
405 stars 143 forks source link

Error resultsing from GET request: http://127.0.0.1:3000/db/collection/id #13

Closed leejsinclair closed 13 years ago

leejsinclair commented 13 years ago

I might be coming from a position of ignorance as this is a second attempt as getting a nodejs project up and running. But is have followed the instructions provided within the README.md text file.

As far as i know i have jade, express and mongo npm packages installed. And within the folder /usr/local/lib/node/.npm/mongodb-rest/active/node_modules they all appear within their respective folders.

The service works fine expect when attempting to retrieve a specific record using the uri structure: http://127.0.0.1:3000/db/collection/id, in my case: http://127.0.0.1:3000/flockworks/agent/4d94aaadd23d5b010c000001. In which case the follow error occurs:

TypeError: undefined is not a function at CALL_NON_FUNCTION_AS_CONSTRUCTOR (native) at Object. (/usr/local/lib/node/.npm/mongodb-rest/0.6.7/package/lib/rest.js:22:21) at param (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/middleware/router.js:148:21) at param (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/middleware/router.js:159:15) at param (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/middleware/router.js:159:15) at param (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/middleware/router.js:159:15) at pass (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/middleware/router.js:164:10) at Object.router as handle at next (/usr/local/lib/node/.npm/connect/1.2.1/package/lib/http.js:204:15) at Object.logger as handle

I have investigated the line error number: query = {'_id': new mongo.ObjectID(req.params.id)};

The parameter req.params.id seems to be set.

Whereas sending a query URL request like '?query={"accountid":"myaccountID"}' works just fine.

i rolled back from node 0.5.0-pre to node 0.4.5 (node --version), as far as i can tell here are the .npm package versions:

Platform Ubuntu 10.10

Any ideas?

tdegrunt commented 13 years ago

Version bump, closed by a096343ef81cddddfd810ae3e73ff4095f496510

tdegrunt commented 13 years ago

Hi there,

Wouldn't worry about it, it's not you! It's just that node.js is moving quickly and I refuse to specify the exact versions of dependencies which is needed for which version of mongodb-rest, I just mention the minimum versions.

My code wasn't suitable for a later mongodb package, 0.6.8 should fix this.

Cheers, Tom.

leejsinclair commented 13 years ago

Thanks so much,

Upgrading to 0.6.8 worked.

Sounds like your on the bleeding edge, good work guys.