Working with MongoDB data can be time-consuming and labor-intensive, requiring you to write extensive validation and business logic. Mongoose, an Object Data Modeling library, makes it easy for you to manage data relationships and provides schema validation for MongoDB objects. In this code pattern, you’ll learn how to use Mongoose to connect to your MongoDB database so you can read and update documents.
Mongoose provides an easy way to model your data with MongoDB. It connects to a MongoDB database so that you can configure your Node.js app to create, read, update, or delete documents in the database. The Express framework helps you make RESTful APIs quickly and easily for your database operations.
This code pattern shows you how to conveniently configure a map server application to use a database for data storage. The application will be deployed in a Kubernetes platform.
This pattern is part of a larger application. That application is a map server where data such as booths, events, and beacons (for generating a heat map of the event) are stored. The map server will be used as a back end for a user-facing dashboard. The dashboard, using the data from the configured APIs of our server, will visualize that data and show a map or floor plan to users. This map server will also be used to generate an indoor map in an iOS app.
When you have completed this code pattern, you will understand how to:
- Implement Mongoose with NodeJS
- Create RESTful APIs with database operations
If you’re ready to harness the flexibility and convenience of Mongoose in your apps, this is your starting point.
- The user sets up a MongoDB database. Compose for MongoDB is used in this pattern.
- The user adds mock data that matches the schema of the models set in the application.
- The user interacts with the deployed app through its APIs. The user can view an indoor map in SVG or PDF format.
You will find the detailed steps for this pattern in the README. Those steps will show you how to:
- Clone the repo.
- Create Compose for MongoDB service with IBM Cloud.
- Build your images.
- Configure deployment files.
- Deploy the application.
- Generate mock data.
- Perform API requests.