Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brettlangdon/mongorest
A very simple MongoDB REST interface written in python.
https://github.com/brettlangdon/mongorest
Last synced: about 2 months ago
JSON representation
A very simple MongoDB REST interface written in python.
- Host: GitHub
- URL: https://github.com/brettlangdon/mongorest
- Owner: brettlangdon
- Created: 2013-05-22T00:55:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-22T00:56:32.000Z (over 11 years ago)
- Last Synced: 2024-10-12T22:44:55.354Z (3 months ago)
- Language: Python
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
mongorest
=========This is just a toy module for creating a REST interface to MongoDB which uses `jsonschema`
to validate data before trying to save into MongoDB collection.## Example
This example creates a REST server with the following routes:
* `GET` `/users/` - return a single document from `users` as JSON or `204`
* `PUT` `/users/` - `PUT` a JSON document into `users` or `400` if data does not validate with the schema
* `GET` `/users` - get all documents from `users` as JSON```python
from mongorest import Serverapp = Server('test', host='my.db.server', port=27017)
users_schema = {'type': 'object',
'properties': {
'name': {'type': 'string'},
'age': {'type': 'number',
'minimum': 0},
'admin': {'type': 'boolean'}},
'required': ['name', 'age', 'admin']}
app.register_collection('users', users_schema)
app.run()
```