Anvi Jain has Published 629 Articles

Get the storage size of a database in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

820 Views

To get the storage size of a database in MongoDB, use the stats() method.At first, check the current database with the help of the following query −> db;The following is the output −testHere is the query to get the storage size of the database in MongoDB −> db.stats()The following is ... Read More

Select MongoDB documents where a field either does not exist, is null, or is false?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

333 Views

You can use $in operator for this. Let us first create a collection with a document. The query to create a collection with a document is as follows −> db.selectMongoDBDocumentsWithSomeCondition.insertOne({"StudentId":1, "StudentName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9010215705caea966c557f") } > db.selectMongoDBDocumentsWithSomeCondition.insertOne({"StudentId":2, "StudentName":"Mike", "hasAgeGreaterThanOrEqualTo18":true}); {    "acknowledged" : true, ... Read More

How does free() know the size of memory to be deallocated?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

2K+ Views

The free() function is used to deallocate memory while it is allocated using malloc(), calloc() and realloc(). The syntax of the free is simple. We simply use free with the pointer. Then it can clean up the memory.free(ptr);The free() is not taking any size as parameter, but only pointer. So ... Read More

Insert records in MongoDB collection if it does not exist?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

2K+ Views

You can use update() function to insert records in MongoDB if it does not exist. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.insertIfNotExistsDemo.insertOne({"StudentName":"Mike", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ... Read More

How to modify a const variable in C?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

5K+ Views

In C or C++, we can use the constant variables. The constant variable values cannot be changed after its initialization. In this section we will see how to change the value of some constant variables.If we want to change the value of constant variable, it will generate compile time error. ... Read More

How are variables scoped in C

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

67 Views

Here we will see how the C variables are scoped. The variables are always statically scoped in C. Binding of a variable, can be determined by the program text. These are independent of runtime function call stack.Let us see one example to get the idea.Example# include int x = ... Read More

How does a C program executes?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

4K+ Views

Here we will see how the C programs are executed in a system. This is basically the compilation process of a C program.The following diagram will show how a C Source Code can be executed.In the above diagram there are different steps −C Code − This is the code that ... Read More

Iterate through Ennead Tuple in Java

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

77 Views

To iterate through the Ennead Tuple, you can use them for a loop. That is it works in the same way like any other collection in Java. Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the ... Read More

What is the $unwind operator in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

267 Views

The $unwind operator in MongoDB is the same for each array, it returns the mapping document. Here is the demo of $unwind operator in MongoDB.To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.unwindOperatorDemo.insertOne({"StudentName":"Larry", ... Read More

“volatile” qualifier in C

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

4K+ Views

Here we will see what is the meaning of volatile qualifier in C++. The volatile qualifier is applied to a variable when we declare it. It is used to tell the compiler, that the value may change at any time. These are some properties of volatile.The volatile keyword cannot remove ... Read More

Advertisements