ltonetwork / mongodb-rest

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

sort and fields, and other options #31

Closed raisch closed 5 years ago

raisch commented 11 years ago

After a quick test of the various query options, I find

?query={"city":"foo"}&fields={"name":1}     crashes server
?query={"city":"foo"}&hint={"name":1}       crashes server
?query={"city":"foo"}&sort={"name":-1}      ignored
?query={"city":"foo"}&explain=1             crashes server

The first three can be fixed by changing line 31 of rest.js from

options[o] = req.query[o];

to

options[o] = JSON.parse(req.query[o]);

But it should be noted that the server code for this project is VERY brittle, lacking any sort of defensive programming or error-handling.

alopezo commented 10 years ago

Great post... solved a problem for me. Thanks

Minstel commented 6 years ago

Confirmed for hint operation, others work ok