| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This example shows how to use Camel MongoDB component. There are three REST endpoints that will trigger the MongoDB component for reading and for writing.
You need to have an instance of MongoDB server running locally.
You can run it as a Docker container:
docker run -d --name mongodb -p 27017:27017 mongoYou can insert an "hello" document by POSTing to /hello endpoint:
$ curl -X POST -H "Content-Type: application/json" -d '{"text":"Hello from Camel"}' http://localhost:8081/hello
The result of the query is of type:
$ Document{{text=Hello from Camel, _id=<document-id>}}
You can read all the documents by requesting to / endpoint:
$ curl localhost:8081
You can also read a single document by setting the id query parameter to the target <document-id>:
$ curl "localhost:8081/hello?id=<document-id>"
If you hit any problem using Camel or have some feedback, then please let us know.
We also love contributors, so get involved :-)
The Camel riders!
| Back | FazBrowse Home | New Git URL |