Nishtha Thakur has Published 564 Articles

Perform aggregation sort in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

190 Views

You can use aggregate() method along with $sort() operator for this. 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.aggregationSortDemo.insertOne({"StudentId":98, "StudentFirstName":"John", "StudentLastName":"Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c90140c5705caea966c5587") } > ... Read More

Macros vs Functions in C

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

In this section we will see what are the differences between macros and functions in C. The macros are pre-processed, so it means that all the macros will be preprocessed while it is compiled. The functions are not preprocessed, but compiled.In macros no type checking is done, so it may ... Read More

LongStream sorted() method in Java

Nishtha Thakur

Nishtha Thakur

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

82 Views

The sorted() method of the LongStream class in Java returns a stream with the elements of this stream in sorted order.The syntax is as follows −LongStream sorted()To use the LongStream class in Java, import the following package −import java.util.stream.LongStream;Create a LongStream and add some elements −LongStream longStream = LongStream.of(80L, 35L, ... Read More

MongoDB find by multiple array items using $in?

Nishtha Thakur

Nishtha Thakur

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

103 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

576 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

4K+ 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

72 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

212 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

3K+ 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

Advertisements