Smita Kapse has Published 498 Articles

Check if a field contains a string in MongoDB?

Smita Kapse

Smita Kapse

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

2K+ Views

You can use $regex operator to check if a field contains a string in MongoDB. The syntax is as follows −db.yourCollectionName.findOne({"yourFieldName":{$regex:".*yourValue.*"}});To understand the above concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.checkFieldContainsStringDemo.insertOne({"Id":1, "Name":"John"}); {   ... Read More

What is an unsigned char in C++?

Smita Kapse

Smita Kapse

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

6K+ Views

In C++ we have seen there is character type data called char. Sometimes we have seen unsigned char also. So here we will see what is basically the unsigned char means. What are the basic differences between signed char and unsigned char?Signed char and unsigned char both are used to ... Read More

Benefits of C over other languages

Smita Kapse

Smita Kapse

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

2K+ Views

The C programming language was developed by Dennis Ritchie during early 1970. It was developed to redesign UNIX operating system.Earlier the B language, which was used for UNIX system, it has different drawbacks. It does not support structures, and did not understand datatypes. For this reason, the C language was ... Read More

Const Qualifier in C

Smita Kapse

Smita Kapse

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

2K+ Views

We use the const qualifier to declare a variable as constant. That means that we cannot change the value once the variable has been initialized. Using const has a very big benefit. For example, if you have a constant value of the value of PI, you wouldn't like any part ... Read More

Collectors averagingInt() method in Java 8

Smita Kapse

Smita Kapse

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

1K+ Views

The averagingInt() method of the Collectors class returns a Collector that produces the arithmetic mean of a int-valued function applied to the input elements.The syntax is as follows −static Collector averagingInt(ToIntFunction

What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__ in C/C++?

Smita Kapse

Smita Kapse

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

2K+ Views

Here we will see what are the differences between __FUNCTION__, __func__ and the __PRETTY_FUNCTION__ in C++.Basically the __FUNCTION__ and __func__ are same. Some old versions of C and C++ supports __func__. This macro is used to get the name of the current function. The _PRETTY_FUNCTION__ is used to return the ... Read More

How to create MongoDB stored procedure?

Smita Kapse

Smita Kapse

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

1K+ Views

The following is the syntax to create MongoDB stored procedure −db.system.js.save (    {       _id:"yourStoredProcedueName",       value:function(argument1, ....N)       {          statement1,          .          .          N       ... Read More

Modulus of Negative Numbers in C

Smita Kapse

Smita Kapse

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

1K+ Views

Here we will see what will be the result if we use negative numbers to get the modulus. Let us see the following programs and their outputs to get the idea.Example#include int main() {    int a = 7, b = -10, c = 2;    printf("Result: %d", a % ... Read More

How to use AND Conjunctive Operators in Android sqlite?

Smita Kapse

Smita Kapse

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

159 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

The toArray() method of CopyOnWriteArrayListin Java

Smita Kapse

Smita Kapse

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

102 Views

The toArray() method is used to return an array containing all the elements in this list in proper sequence.The syntax is as follows −Object[] toArray()To work with CopyOnWriteArrayList class, you need to import the following package −import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class toArray() method in Java−Example Live ... Read More

Advertisements