[SERVER-2030] Better REST api query Created: 29/Oct/10 Updated: 07/Jul/17 Resolved: 07/Jul/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | HTTP Console |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Eliot Horowitz (Inactive) | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Done | Votes: | 6 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
Doing field by field isn't great so we should deprecate. Should add GET /db/collection in the body |
| Comments |
| Comment by Radu Toader [ 10/Jul/15 ] |
|
Hi, It's not usefull if I cannot search for objects which have a string id / key and cannot find them. |
| Comment by Ivan Hristov [ 05/Dec/12 ] |
|
Seems like there is not much of a motivation to improve the build-int REST API. Thus I would like to point that better REST API will definitely make MongoDB much easier to place in new projects as proof of concept and later switch to more powerful REST API. One great advantage of using MongoDB built-in API is that you can serve the content directly without having to bother with installing anything else bug MongoDB. In addition, it would be nice to have a MongoDB REST API module which we can install / enable if needed in contrast to have the logic built-in the core server. This will also facilitate contributing to this module only. |
| Comment by eh old1 [ 06/Jul/12 ] |
|
Same question here.... I can't search for hex encoded _id values in other records - http://127.0.0.1:28017/test/apps/?filter_room_id=4ff63758cf1d77f51c000000 Should be querying with { "room_id" : "4ff63758cf1d77f51c000000" }but is truncating the ID: { ], "total_rows" : 0 , , |
| Comment by Mike McWilliams [ 16/Mar/12 ] |
|
If I'm trying to search for {"sym":"500TEST"}, how do I force the api to use quotes? http://localhost:28017/cache/entry/?filter_rec.sym=500TEST&limit=100&jsonp=? ], "total_rows" : 0 , , Any help is greatly appreciated. |
| Comment by Remon van Vliet [ 08/Jan/11 ] |
|
Speaking as someone that designs RESTful WS APIs for a living I would much appreciate if this could follow RESTful WS best practices as closely as possible. As such you should not use a POST for a query. A query should be implemented using the GET http verb, updates/upserts as PUT, inserts as POST, remove as DELETE, etc. Make sure URI design and HTTP status code usage is proper too please. The query parameter as in your first suggestion seems a good start. URI composition should include database name, collection name and optionally field name, e.g. : find(criteria, fields) : GET http(s)://[host]:[port]/[database]/[collection]/?criteria=[criteria]&fields=[fields] I would also suggest allowing the typical GET/PUT by id, in mongo's case the _id field so that : find({_id: id}) : GET http(s)://[host]:[port]/[database]/[collection]/[id] work as they should. I'm happy to create a draft design if someone is interested. |
| Comment by Eliot Horowitz (Inactive) [ 06/Nov/10 ] |
|
Correct. |
| Comment by Valery Khamenya [ 06/Nov/10 ] |
|
Issue http://jira.mongodb.org/browse/SERVER-1800 is already closed and this one isn't yet implemented. |