MongoDB is a NoSQL type, open-source document database. This sample demonstrates the usage of MongoDB as a data source in WSO2 DSSEnterprise Integrator (WSO2 EI).
Table of Contents | ||||
---|---|---|---|---|
|
About the sample
This sample data service contains the operations listed below. See About Data Services and Resources for a definition of data services and operations.
- mongo_insert: This operation adds a document according to the provided id, name.
- mongo_insert_doc: Using this operation you can inserts a document into the 'things' collection:
- mongo_find: This operation returns all documents from the collection.
- mongo_count: This operation counts and returns the number of all documents in the 'things' collection
- mongo_update: This operation sets the name as 'Zack' and the id as the provided value for the document where name is 'Bob'
- mongo_remove: This operation removes all the documents from the collection 'things' where id is equal to the given value
- mongo_drop: This operation will drop the collection 'things' from the database
Prerequisites
A MongoDB server v2.4.x or v2.2.x should be already running in the default port. Create a collection as below in the command shell.
Code Block |
---|
mongo use mydb db.createCollection("things") db.things.insert( { id: 1, name: "Document1" } ) |
Building the sample
The sample data service named MongoDBSample
should be deployed using the instructions in the Samples Setup section.
Running the sample
The sample can be run using any SOAP client such as the Tryit tool that tool that comes bundled with WSO2 DSSEI.
Follow the steps below to demonstrate this functionality using the TryIt tool:
...