- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6702 Articles for Database
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
114 Views
To get the count of repeated values in different documents, use aggregate(). Let us create a collection with documents −> db.demo452.insertOne({"StudentName":"John", "StudentAge":21});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b7e3371f552a0ebb0a6f3") } > db.demo452.insertOne({"StudentName":"John", "StudentAge":22});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b7e3671f552a0ebb0a6f4") } > db.demo452.insertOne({"StudentName":"John", "StudentAge":23});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b7e3971f552a0ebb0a6f5") } > db.demo452.insertOne({"StudentName":"David", "StudentAge":24});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b7e4371f552a0ebb0a6f6") } > db.demo452.insertOne({"StudentName":"David", "StudentAge":25});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b7e4571f552a0ebb0a6f7") }Display all documents from a collection with the help of find() method −> db.demo452.find();This will produce the following output −{ "_id" : ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
744 Views
To get the mean daily average count of recorded documents, use aggregate(). Within that, use $project and $group.Let us create a collection with documents −Example> db.demo451.insertOne({ ... DueDate:new ISODate("2020-03-15T10:50:35.000Z"), ... Value: 10 ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e7b5c5d71f552a0ebb0a6e9") } > db.demo451.insertOne({ ... DueDate:new ISODate("2020-03-14T10:50:35.000Z"), ... Value: 10 ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e7b5c5d71f552a0ebb0a6ea") } > db.demo451.insertOne({ ... DueDate:new ISODate("2020-03-13T10:50:35.000Z"), ... Value: 10 ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e7b5c5d71f552a0ebb0a6eb") }Display all documents from a collection with the help of find() ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
115 Views
In order to reach subdata, you need to use key in MongoDB. Let us create a collection with documents −>db.demo450.insertOne({"Information":{"StudentDetails":{"StudentName":"Chris", "StudentAge":21}}}); { "acknowledged" : true, "insertedId" : ObjectId("5e7b590e71f552a0ebb0a6e6") } >db.demo450.insertOne({"Information":{"StudentDetails":{"StudentName":"David", "StudentAge":23}}});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b591a71f552a0ebb0a6e7") } >db.demo450.insertOne({"Information":{"StudentDetails":{"StudentName":"Mike", "StudentAge":22}}});{ "acknowledged" : true, "insertedId" : ObjectId("5e7b592271f552a0ebb0a6e8") }Display all documents from a collection with the help of find() method −> db.demo450.find();This will produce the following output −{ "_id" : ObjectId("5e7b590e71f552a0ebb0a6e6"), "Information" : { "StudentDetails" : { "StudentName" : "Chris", "StudentAge" : 21 } } } { "_id" : ObjectId("5e7b591a71f552a0ebb0a6e7"), "Information" : { "StudentDetails" : { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
762 Views
To insert an item to an already created array inside an object, use MongoDB $push. Let us create a collection with documents −> db.demo449.insertOne( ... { ... details1: { ... details2: [{ ... _id:new ObjectId(), ... Name:"Chris" ... }], ... details3: [{ ... _id:new ObjectId(), ... Name:"David" ... }] ... } ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e7a40e971f552a0ebb0a6e3") }Display all documents from ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
The findOneAndDelete() deletes single documents from the collection on the basis of a filter and sort criteria as well as it returns the deleted document.The deleteOne() removes single document from the collection.Let us see an example and create a collection with documents −> db.demo448.insertOne({"Name":"Chris", "Age":21});{ "acknowledged" : true, "insertedId" : ObjectId("5e7a291cbbc41e36cc3caeca") } > db.demo448.insertOne({"Name":"David", "Age":23});{ "acknowledged" : true, "insertedId" : ObjectId("5e7a2926bbc41e36cc3caecb") } > db.demo448.insertOne({"Name":"Bob", "Age":22});{ "acknowledged" : true, "insertedId" : ObjectId("5e7a2930bbc41e36cc3caecc") }Display all documents from a collection with the help of find() method −> db.demo448.find();This will produce the following output −{ "_id" : ObjectId("5e7a291cbbc41e36cc3caeca"), ... Read More
![Mahesh Parahar](https://www.tutorialspoint.com/assets/profiles/127878/profile/60_2277600-1655382864.jpg)
1K+ Views
Inverted Index and Forward Index are data structures used to search text in a document or set of documents.Inverted IndexInverted Index stores the words as index and document name(s) as mapped reference(s).Forward IndexForward Index stores the document name as index and word(s) as mapped reference(s).The following are some of the important differences between the Inverted Index and Forward Index.Sr. No.KeyInverted IndexForward Index1Mapping PatternInverted Index stores the words as index and document name(s) as mapped reference(s).Forward Index stores the document name as index and word(s) as mapped reference(s).2Index Building ProcessScan the document, prepare a list of unique words.Prepare a list of ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
636 Views
Data scientists, data engineers, and data analysts are all professionals who work with data in some way. However, they have different roles and responsibilities. Read this article to find out more the job profiles of data scientists, data engineers, and data analysts and how you can distinguish among them. Who is a Data Scientist? A Data Scientist is one who analyses and interprets complex data in digital form. Data scientists are responsible for extracting insights and knowledge from data. They use a variety of techniques, including machine learning, to analyze data and communicate their findings to stakeholders. There are several ... Read More
![Mahesh Parahar](https://www.tutorialspoint.com/assets/profiles/127878/profile/60_2277600-1655382864.jpg)
23K+ Views
Static SQLStatic SQL refers to those SQL statements which are fixed and can be hard coded into the application. As static sqls are fixed queries, these statements can be analysed and optimized and do not require any specific handling for security purpose.Dynamic SQLDynamic SQL refers to those SQL statements which are generated dynamically based on user's input and run in the application. Dynamic Sqls helps to develop general and flexible applications. Dynamic SQL may need more permissions and security handling and a malicious user can create dangerous code as well.Following are some of the important differences between Static Routing and ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
402 Views
For this, use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable2040 -> ( -> StudentCode varchar(20) -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2040 values('John-232'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable2040 values('Carol-901'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable2040 values('David-987'); Query OK, 1 row affected (0.21 sec)Display all records from the table using select statement −mysql> select *from DemoTable2040;This will produce the following output −+-------------+ | StudentCode | +-------------+ | ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
100 Views
To display a list of records in a specific order, you need to set conditions and use ORDER BY. For this, use ORDER BY CASE statement. Let us first create a table −mysql> create table DemoTable2039 -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2039 values('John Doe'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable2039 values('John Smith'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable2039 values('Chris Brown'); Query OK, 1 row affected ... Read More