https://github.com/kshirish/mongrest
HTTP rest interface to play with mongodb
https://github.com/kshirish/mongrest
http mongodb rest
Last synced: 10 months ago
JSON representation
HTTP rest interface to play with mongodb
- Host: GitHub
- URL: https://github.com/kshirish/mongrest
- Owner: kshirish
- License: mit
- Created: 2015-08-14T13:17:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T10:31:46.000Z (over 3 years ago)
- Last Synced: 2024-03-15T22:03:39.042Z (about 2 years ago)
- Topics: http, mongodb, rest
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mongrest
_**Mongrest**_ provides an HTTP interface for your mongodb.
## How to use
* ```npm install -g mrest```
* ```mrest --port= --url=```
## Supported RESTful urls
### CRUD
* GET /users - Retrieves a list of users
* GET /users/12 - Retrieves a user with #12
* POST /users/add - Creates a new user
* PUT /users/12 - Updates user #12
* DELETE /users/12 - Deletes user #12
### Filter
* GET /tickets?state=open - Retrieves tickets with state open
### Sort
* GET /users?sort=-priority - Retrieves a list of users in descending order of priority
### Limit fields
* /users?fields=-id,username,first_name
### Limit results
* GET /users?limit=10 - Retrives only top 10 results
### Combined
* GET /users?limit=10&fields=-id,fullname,username&sort=-username
### Misc
* GET /stats - stats for the current database
* GET /list - lists collections in the current database
* POST /test/new - create a new collection 'test'
* DELETE /test - delete 'test' collection
### Query to mongo
* POST /users/filter
```name=john&age>21&fields=name,age&sort=name,-age&offset=10&limit=10```