- 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
Samual Sam has Published 2492 Articles
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
499 Views
You can use $lt operator for this. Let us create a collection with documents −> db.beforeSpecifyDateDemo.insertOne({"UserLoginDate":new ISODate('2016-03-21')}); { "acknowledged" : true, "insertedId" : ObjectId("5cbd91e4de8cc557214c0e0d") } > db.beforeSpecifyDateDemo.insertOne({"UserLoginDate":new ISODate('2016-05-11')}); { "acknowledged" : true, "insertedId" : ObjectId("5cbd91ecde8cc557214c0e0e") } > db.beforeSpecifyDateDemo.insertOne({"UserLoginDate":new ISODate('2017-01-31')}); { "acknowledged" : true, "insertedId" ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
421 Views
Let us create a collection with documents −> db.selectOnlyNumericDemo.insertOne({"UserId":"User101"}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdb711de8cc557214c0e16") } > db.selectOnlyNumericDemo.insertOne({"UserId":"102"}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdb716de8cc557214c0e17") } > db.selectOnlyNumericDemo.insertOne({"UserId":"User103"}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdb71dde8cc557214c0e18") } > db.selectOnlyNumericDemo.insertOne({"UserId":"104"}); { "acknowledged" : true, ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
165 Views
You can use every() in MongoDB for this. Let us create a collection with documents −> db.arrayConditionDemo.insertOne({"Name":"John", "Marks":[40, 43, 45]}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdbd06de8cc557214c0e1a") } > db.arrayConditionDemo.insertOne({"Name":"Mike", "Marks":[45]}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdbd17de8cc557214c0e1b") } > db.arrayConditionDemo.insertOne({"Name":"Chris", "Marks":[43, 45, 59, 69, 78, ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
700 Views
You can use printjson() or print() to get output of MongoDB shell script. Let us create an array of objects.Following is the query to create an array of objects.> var studentDetails=[{"StudentName":"John", "StudentAge":21}, {"StudentName":"Carol", "StudentAge":24}, {"StudentName":"David", "StudentAge":25}];Following is the query to get the output of Mongo shell script using printjson() ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
191 Views
Yes, Mongo shell treats numbers as float by default. To work it as int or any other type, you need to mention explicitly. You can use NumberInt() for this. The syntax is as follows −var anyVariableName= [NumberInt("yourValue1"), NumberInt("yourValue2"), .....N];Let us implement the above syntax in order to treat numbers as ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
923 Views
To get attribute list from MongoDB object, you can use for loop to extract key and value for document. Let us create a collection with documents −>db.getAttributeListDemo.insertOne({"StudentId":101, "StudentName":"John", "StudentAdmissi onDate":new ISODate('2019-01-12'), "StudentSUbjects":["MongoDB", "Java", "MySQL"]}); { "acknowledged" : true, "insertedId" : ObjectId("5cbdfcc9ac184d684e3fa269") }Display all documents from a collection with ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
1K+ Views
In C++11, we can get the random library to generate random numbers. Here we have used random_device once to seed the random number generator object called mt. This random_device is slower than the mt19937, but we do not need to seed it. It requests for random data to the operating ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
178 Views
In C++11, the lambda was introduced. Lambdas are basically a part of, that can be nested inside other function call statements. By combining lambda expressions with the auto keyword, they can be used later.In C++14, these lambda expressions are improved. Here we can get the generalized or generic lambda. For ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
687 Views
Here we will see how to initialize the const type variable using constructor?To initialize the const value using constructor, we have to use the initialize list. This initializer list is used to initialize the data member of a class. The list of members, that will be initialized, will be present ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
2K+ Views
Here we will see how to get the memory usage statistics under Linux environment using C++.We can get all of the details from “/proc/self/stat” folder. Here we are taking the virtual memory status, and the resident set size.Example#include #include #include #include #include using namespace std; ... Read More