Nishtha Thakur has Published 581 Articles

MongoDB find by multiple array items using $in?

Nishtha Thakur

Nishtha Thakur

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

78 Views

You can use $in operator to find with multiple array items. 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.findByMultipleArrayDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith",    "StudentCoreSubject":["Compiler", "Operating System", "Computer Networks"]}); {    "acknowledged" : true,    "insertedId" : ... Read More

Redeclaration of global variable in C

Nishtha Thakur

Nishtha Thakur

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

418 Views

Here we will see what is re-declaration of global variables in C. Does C supports this or not. Let us see the following code to get the idea about it.Example#include int main(){    int a;    int a = 50;    printf("a is : %d", a); }Output[Error] redeclaration of ... Read More

Pre-increment and Post-increment in C/C++

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

Here we will see what is the pre-increment and post-increment in C or C++. The pre-increment and post-increment both are increment operators. But they have little differences.The pre-increment operator increments the value of a variable at first, then sends the assign it to some other variable, but in the case ... Read More

What is the setAtX() method of the Ennead Tuple in Java

Nishtha Thakur

Nishtha Thakur

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

38 Views

To set Ennead value in Java, you need to use the setAtX() method. Here, X represents the index wherein you need to set the value i.e. for index 1, use setAt1() method. Set the value as the parameter value of the method.Let us first see what we need to work ... Read More

Querying array elements with MongoDB?

Nishtha Thakur

Nishtha Thakur

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

156 Views

MongoDB is better when you are querying array elements. Let us use the following syntax for querying array elements −db.yourCollectionName.find({yourArrayFieldName:"yourValue"}).pretty();The above syntax will return all those documents which have the value “yourValue” in an array field.To understand the concept, let us create a collection with the document. The query to ... Read More

Address of a function in C or C++

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

In C or C++, the variables are stored into memory, so we can get their memory addresses. Similarly, the functions also are stored into the memory, so they also have some addresses. To get the address we can use the function name only without using the parenthesis.Please check the following ... Read More

Difference between while(1) and while(0) in C/C++

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

Here we will see what are the differences between while(1) and while(0) in C or C++. The while is a loop of C or C++. Using this loop we can check one condition, and the statements inside the loop will be executed while the condition is true.The while(1) or while(any ... Read More

How to add a value in Octet Tuple in Java

Nishtha Thakur

Nishtha Thakur

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

38 Views

To add value in Octet Tuple, you need to use the addAtX() method. Here, X is the index wherein you need to add the value i.e. to add value at index 0, use the addAt0() and value as a parameter.Let us first see what we need to work with JavaTuples. ... Read More

How to find Second most repeated string in a sequence in android?

Nishtha Thakur

Nishtha Thakur

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

106 Views

This example demonstrate about How to find Second most repeated string in a sequence in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. ... Read More

Include all existing fields and add new fields to document in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

247 Views

You can achieve this with the help of $addFields operator. 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.addFieldDemo.insertOne({"EmployeeId":101, "EmployeeName":"Larry", "EmployeeDetails":{    "EmployeeSalary":65000, "EmployeeCity":"New York", "Message":"Hi"}}); {    "acknowledged" : true,    "insertedId" ... Read More

Advertisements