Smita Kapse has Published 558 Articles

How can I rename a field for all documents in MongoDB?

Smita Kapse

Smita Kapse

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

249 Views

The syntax is as follows to rename a field for all documents. Here, we have used $renameLdb.yourCollectionName.update({}, {$rename:{"yourOldFieldName":"yourNewFieldName"}}, false, true);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.renameFieldDemo.insertOne({"StudentName":"John"}); {    "acknowledged" : true, ... Read More

Convert C/C++ code to assembly language

Smita Kapse

Smita Kapse

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

6K+ Views

Here we will see how to generate assembly language output from C or C++ source code using gcc.The gcc provides a great feature to get all intermediate outputs from a source code while executing. To get the assembler output we can use the option ‘-S’ for the gcc. This option ... Read More

wcspbrk() function in C/C++

Smita Kapse

Smita Kapse

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

103 Views

The wcspbrk() function is a built in function of C or C++. It searches for a set of wide characters present in a wide string in another wide string. This function is present into cwhar header file.This function takes two arguments. The first argument is destination, and the second argument ... Read More

MongoDB find by multiple array items?

Smita Kapse

Smita Kapse

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

803 Views

You can use $all operator to find by 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

LongStream skip() method in Java

Smita Kapse

Smita Kapse

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

98 Views

The skip() method of the LongStream class returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream.The syntax is as follows −LongStream skip(long numEle)Here, numEle is the number of elements to be skipped.To use the LongStream class in Java, import ... Read More

How to get distinct list of sub-document field values in MongoDB?

Smita Kapse

Smita Kapse

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

244 Views

To get distinct list of sub-document field values, you can use dot(.). The syntax is as follows −db.yourCollectionName.distinct("yourOuterFieldName.yourInnerFieldName");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.getDistinctListOfSubDocumentFieldDemo.insertOne(    ... {       ... ... Read More

Convert C/C++ program to Preprocessor code

Smita Kapse

Smita Kapse

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

375 Views

Here we will see how to generate the preprocessed or preprocessor code from the source code of a C or C++ program.To see the preprocessed code using g++ compiler, we have to use the ‘-E’ option with the g++.Preprocessor includes all of the # directives in the code, and also ... Read More

How a Preprocessor works in C/C++?

Smita Kapse

Smita Kapse

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

295 Views

Here we will see how the preprocessors are working in C or C++. Let us see what are the preprocessors.The preprocessors are the directives, which give instructions to the compiler to preprocess the information before actual compilation starts.All preprocessor directives begin with #, and only white-space characters may appear before ... Read More

LongStream sequential() method in Java

Smita Kapse

Smita Kapse

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

71 Views

The sequential() method of the LongStream class in Java returns an equivalent stream that is sequential.The syntax is as follows −LongStream sequential()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(50L, 70L, 100L, 150L, 200L, 300L);Now, return ... Read More

Implicit initialization of variables with 0 or 1 in C

Smita Kapse

Smita Kapse

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

197 Views

We know that we need to declare variables before using it in our code. However, we variables can be assigned with 0 or 1 without declaration. In the following example we can see this.Example#include #include x, y, array[3]; // implicit initialization of some variables int main(i) {   ... Read More

Advertisements