{{theTime}}

Search This Blog

Total Pageviews

MongoDB Tutorial

MongoDB Tutorial

Table of Contents

Introduction to MongoDB

MongoDB is a popular open-source NoSQL database that provides high performance, high availability, and automatic scaling.

Installation

To install MongoDB, follow the instructions provided in the official MongoDB documentation.

Creating a Database


use mydatabase

Creating a Collection


db.createCollection("mycollection")

Inserting Data


db.mycollection.insertOne({
  name: "John Doe",
  age: 30,
  email: "john@example.com"
})

Querying Data


db.mycollection.find()

Updating Data


db.mycollection.updateOne(
  { name: "John Doe" },
  { $set: { age: 35 } }
)

Deleting Data


db.mycollection.deleteOne({ name: "John Doe" })

No comments:

Generate Insert Sql from Select Statement

SELECT 'INSERT INTO ReferenceTable (ID, Name) VALUES (' +        CAST(ID AS NVARCHAR) + ', ''' + Name + ''...