2. • Agenda
• MongoDB setup
• Configuring MongoDB Component in Mule flow
• Insert/Save the record to MongoDB
• Retrieve the Record from MongoDB
• Demo
3. Set Up
• Install Mongo DB that supports your OS from
• https://www.mongodb.com/download-center#community
• MongoDB requires a data folder to store its files. The default
location for the MongoDB data directory is c:datadb. So you need
to create this folder using the Command Prompt.
• Create the DB using the commands
• C:>md data
• C:md datadb
• Start the mongo DB server:
• Open new DOS Command prompt as Administrator and Navigate to
Mongo DB installation folder: C:Program
FilesMongoDBServer3.4bin
• > mongod
4. MongoDBConfiguration
• Mule Flow
• Configure the HTTP endpoint to receive Http JSON request.
• The JSON request mapped to Payload and corresponding payload
provided to mongoDB component for persistence.
5. MongoDBConfiguration
Provide Database credentials and the Database name
Database will be created automatically it there is no DB exists with the given
name
Need to provide collection name to store the data (here developer)
6. Insert/Save the record to MongoDB
• Post JSON from postman
• Testing Insert:
• Open command prompt and open mongo DB client console.
• C: cd C:Program FilesMongoDBServer3.4bin
• C:> mongo
• > db.developer.find().pretty()
7. Query the Record from MongoDB
• Request from Postman
Log statement: