-
Notifications
You must be signed in to change notification settings - Fork 1
Mongo
This api provides read-only access to data stored in the cyberCommons MongoDB
- db - database
- col - collection
- query - Mongo query (optional)
- callback - Callback for JSONP (optional)
- showids - Boolean for returning internal Mongo _id's (defaults to False)
All arguments can be provided as GET or POST arguments and/or positional arguments in the order above.
Example:
http://test.cybercommons.org/mongo/db_find/?db=flora&col=data
is the same as:
http://test.cybercommons.org/mongo/db_find/flora/data/
which is the same as:
wget --post-data "db=flora&col=data" http://test.cybercommons.org/mongo/db_find/ -O flora.json
List databases:
http://test.cybercommons.org/mongo/db_find/
List collections:
http://test.cybercommons.org/mongo/db_find/flora/
Query a collection any kwarg for pymongo's collection.find() will be passed:
http://test.cybercommons.org/mongo/db_find/flora/data/{'spec':{'REF_NO':11}}
http://test.cybercommons.org/mongo/db_find/flora/data/{'limit': 10}
http://test.cybercommons.org/mongo/db_find/flora/data/{'spec':{'REF_NO':11},'fields':["REF_NO","NO_Genera","NO_Species"]}
http://test.cybercommons.org/mongo/db_find/flora/data/{'spec':{'REF_NO':11}}
Query with callback:
http://test.cybercommons.org/mongo/db_find/flora/data/?callback=Somefunction
http://test.cybercommons.org/mongo/db_find/flora/data/{'spec':{'REF_NO':11},'fields':["REF_NO","NO_Genera","NO_Species"]}?callback=Anotherfunction
- db - database
- col - collection
- distinct_key - key to compute distinct over
- query - query to limit data
- callback (optional)
Examples:
http://test.cybercommons.org/mongo/distinct/teco/taskresults/year/{'spec':{'task_id':'961d4f18-d88e-4cbd-8849-42a9a712ff82'}}
- db - database
- col - collection
- key - key to aggregate over
- variable - variable to sum, count and average
- callback - Callback for JSONP (optional)
Example:
http://test.cybercommons.org/mongo/group_by/teco/taskresults/['year','month']/npp/{'task_id':'20b9a88d-fe01-4f7b-9920-19b1dac68632'}
Returns a GeoJSON object for each Mongo object containing latitude and longitude keys
-
db - database
-
col - collection
-
lon - Longitude key
-
lat - Latitude key
-
id - Id key
-
query - query to limit data
-
callback - Callback for JSONP (optional)
http://test.cybercommons.org/mongo/find_loc/flora/data/midlat/midlon/ http://test.cybercommons.org/mongo/find_loc/flora/data/midlon/midlat/REF_NO/ http://test.cybercommons.org/mongo/find_loc/flora/data/midlat/midlon/REF_NO/True