Skip to content

saikk9834/MongoDB-Node-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<style> body { margin: 0; font-family: 'Red Hat Display', sans-serif; } .button1 { padding: 8px 12px 8px 12px; border: none; border-radius: 4px; margin: 5px 0px 5px 0px; font-size: 12px; color: #fff; text-align: center; font-size: 16px; background-color: #FF0000; font-family: 'Red Hat Display', sans-serif; } .navbar { overflow: hidden; background-color: white; padding-top: 10px; padding-bottom: 10px; position: fixed; top: 0; width: 100%; } .navbar a { float: left; display: block; text-align: center; padding: 5px 16px; text-decoration: none; font-size: 17px; } .main { padding: 16px; margin-top: 10px; height: 1500px; /* Used in this example to enable scrolling */ }

} </style>

MongoDB Enterprise Advanced from IBM

MongoDB Enterprise Advanced from IBM logo

A robust, scalable, highly available document database solution that enables developers and supports mission-critical enterprise deployments.

Overview

IBM Data Management Platform for MongoDB Enterprise Advanced is a data platform and document database that enables developers to build apps faster and distribute data to where it needs to be, with the freedom to run anywhere. This modern database platform provides a rich data environment and enterprise tooling to support mission-critical, highly secure and always-on deployments.

Login

Launch the application and Login into it. It will basically create a server connection on the API server side. The following API is called and a POST method is used to login:

POST http://localhost:3000/api/login
Content-Type: application/json
    
    {
      "username": "",
      "password": "",
      "hosts": [
        {
          "host": "localhost",
          "port": 27017
        }
      ]
    }
  • Response:
   {
      "success" : true,
      "token": "TOKEN"
   } 

Login Clicking on Login will perform a POST request to establish a connection to the MongoDB Operator.

MongoDB CRUD Operations

CRUD operations create, read, update, and delete

Create Operations

Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection.

MongoDB provides the following methods to insert documents into a collection:

  • db.collection.insertOne()

  • db.collection.insertMany()

In MongoDB, insert operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.

url

Example

db.inventory.insertOne( { item: "canvas", qty: 100, tags: ["cotton"], size: { h: 28, w: 35.5, uom: "cm" } } )

Insert Clicking on Insert will perform a POST request to the already established MongoDB connection and insert data into the database.

Read Operations

Read operations retrieve documents from a collection; i.e. query a collection for documents. MongoDB provides the following methods to read documents from a collection:

  • db.collection.find()

You can specify query filters or criteria that identify the documents to return.

url

Example

db.inventory.find( { item: "canvas" } )

Read Clicking on Read will perform a GET request to the already established MongoDB connection and get data from the database.

Update Operations

Update operations modify existing documents in a collection. MongoDB provides the following methods to update documents of a collection:

  • db.collection.updateOne()

  • db.collection.updateMany()

  • db.collection.replaceOne()

In MongoDB, update operations target a single collection. All write operations in MongoDB are atomic on the level of a single document.

You can specify criteria, or filters, that identify the documents to update. These :ref:filters use the same syntax as read operations.

url

Example

db.inventory.updateOne( { item: "canvas" }, { $set: { "size.uom": "cm", status: "P" }, $currentDate: { lastModified: true } } )

Update Clicking on Update will perform a PUT request to the already established MongoDB connection and update the data in the database.

Delete Operations

Delete operations remove documents from a collection. MongoDB provides the following methods to delete documents of a collection:

  • db.collection.deleteOne()

  • db.collection.deleteMany()

In MongoDB, delete operations target a single :term:collection. All write operations in MongoDB are atomic on the level of a single document.

You can specify criteria, or filters, that identify the documents to remove. These filters use the same syntax as read operations.

url

Example

db.inventory.removeOne({})

Delete Clicking on Delete will perform a DELETE request to the already established MongoDB connection and delete the data from the database.

Logout (to destroy the connection on the server side)

POST http://localhost:3000/api/logout
X-TOKEN: TOKEN

Response:

   {
      "success" : true
   } 

Logout Clicking on Logout will perform a POST request to the already established MongoDB connection and will end the session with the MongoDB Operator.

Sample Applications

This sample application helps you explore CRUD operations with a sample react application Sample Application 1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published