
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
203 Views
Let us first create a collection with documents −> db.demo394.insertOne( ... { ... ... details: [ ... { ... _id: '1', ... startDate: '2018-01-11T07:00:00.000Z', ... endDate: '2019-01-12T07:59:59.999Z' ... ... Read More

AmitDiwan
380 Views
For this, use aggregate(). Let us first create a collection with documents −> db.demo393.insertOne( ... { ... Id1: "1", ... Name: "Chris", ... Id2: "100" ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e5e6dd522064be7ab44e804") } ... Read More

AmitDiwan
541 Views
To pull values, use $pull and set multi: true. Let us first create a collection with documents −> db.demo392.insertOne( ... { ... Name: 'Chris', ... details: [ ... { ... _id: '101' ... ... Read More

AmitDiwan
546 Views
To get a single element, use aggregation and LIMIT. The skip() is used to skip a specific number of documents.Let us first create a collection with documents −> db.demo391.insertOne( ... { "_id" : 101, "Name" : "Chris", Values: ["101", "102"] } ... ) { "acknowledged" : true, "insertedId" : ... Read More

AmitDiwan
438 Views
You need to set multi to true. Include the option multi − true to update all documents that match the query criteria.Let us first create a collection with documents −> db.demo390.insertOne({"FirstName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5e5d1f3a22064be7ab44e7fa") } > db.demo390.insertOne({"FirstName":"David"}); { "acknowledged" : true, "insertedId" ... Read More

AmitDiwan
667 Views
Let us first create a collection with documents −> db.demo389.insertOne( ... { ... "details":[ ... { ... "Name":[ ... "Chris", ... "David" ... Read More

AmitDiwan
392 Views
To remove, use $pull in MongoDB. Let us first create a collection with documents −> db.demo388.insertOne( ... { ... _id: '101', ... userDetails: { ... isMarried: false, ... userInfo: [ ... ... Read More

AmitDiwan
686 Views
To unwind, means to deconstruct an array field from the input documents to output a document for each element.To unwind arrays, use $unwind in MongoDB aggregation. Let us first create a collection with documents −> db.demo387.insertOne( ... { ... ... "Name" : "101", ... ... Read More

AmitDiwan
323 Views
Let us first create a collection with documents −> db.demo386.insert( ... { ... details: { Month: 02, Day: 27, Year: 2020 } ... } ... ); WriteResult({ "nInserted" : 1 })Display all documents from a collection with the help of find() method −> db.demo386.find();This will ... Read More

AmitDiwan
2K+ Views
To update multiple elements, use $[]. The $[] is an all positional operator indicating that the update operator should modify all elements in the specified array field.Let us first create a collection with documents −> db.demo385.insertOne({"ServerLogs": [ ... { ... "status":"InActive" ... ... Read More