Smita Kapse has Published 558 Articles

MongoDB query where all array items are greater than a specified condition?

Smita Kapse

Smita Kapse

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

459 Views

You can use $gt operator for this. Let us first create a collection with documents −> db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[89, 43, 32, 45]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9e9f9b50a6c6dd317adb3") } > db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[32, 33, 34, 40]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd9ea13b50a6c6dd317adb4") } > db.arrayElementsNotGreaterThanDemo.insertOne({"Scores":[45, 56, 66, 69]}); ... Read More

ldexp() function in C/C++

Smita Kapse

Smita Kapse

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

123 Views

Here we will see what is the use of ldexp() method in C or C++. This function returns any variable x raise to the power of exp value. This takes two arguments x and exp.The syntax is like below.float ldexp (float x, int exp) double ldexp (double x, int exp) ... Read More

How to get array from a MongoDB collection?

Smita Kapse

Smita Kapse

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

296 Views

You can use aggregate framework. Let us first create a collection with documents −> db.getArrayDemo.insertOne(    {       "CustomerId":101,       "CustomerDetails":[          {             "CustomerName":"Larry",             "CustomerFriendDetails":[             ... Read More

Why strict aliasing is required in C?

Smita Kapse

Smita Kapse

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

121 Views

Here we will see, why we should use the strict aliasing in C. Before discussing that part, let us see one code, and try to analyze the output.Example#include int temp = 5; int* var = &temp; int my_function(double* var) {    temp = 1;    *var = 5.10; //this will change the value of temp    return (temp); } main() {    printf("%d",  my_function((double*)&temp)); }Output1717986918If we ... Read More

How to make an icon in the action bar with the number of notifications in Android?

Smita Kapse

Smita Kapse

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

101 Views

This example demonstrate about How to make an icon in the action bar with the number of notifications in AndroidStep 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 ... Read More

Updating sub-object in MongoDB?

Smita Kapse

Smita Kapse

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

410 Views

You can use $set operator for this. Let us first create a collection with documents −> db.updateSubObjectDemo.insertOne( ...    { ... ...       "ClientId" : 100, ...       "ClientDetails" : { ...          "ClientFirstName" : "Adam" ...       } ...   ... Read More

Push new key element into subdocument of MongoDB?

Smita Kapse

Smita Kapse

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

224 Views

You can use $set operator for this. Following is the syntax −db.yourCollectionName.update({"_id" : yourObjectId }, {$set: { "yourOuterFieldName.anyInnerFieldName": yourValue}});Let us first create a collection with documents −> db.pushNewKeyDemo.insertOne({"UserId":100, "UserDetails":{}}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda58f5b50a6c6dd317adbf") }Following is the query to display all documents from a collection with ... Read More

remainder() in C++

Smita Kapse

Smita Kapse

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

146 Views

Here we will see the functionality of remainder() method of C++. The remainder() function is used to compute the floating point remainder of numerator/denominator.So the remainder(x, y) will be like below.remainder(x, y) = x – rquote * yThe rquote is the value of x/y. This is rounded towards the nearest ... Read More

How to read the contents of a JSON file using Java?

Smita Kapse

Smita Kapse

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

8K+ Views

JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers, which include C, C++, Java, Python, Perl, etc. Sample JSON document −{    "book": [       {          "id": "01",   ... Read More

What does it mean when a numeric constant in C/C++ is prefixed with a 0?

Smita Kapse

Smita Kapse

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

122 Views

Sometimes we may see some numeric literals, which is prefixed with 0. This indicates that the number is octal number. So octal literals contain 0 at the beginning. For example, if an octal number is 25, then we have to write 025.Example#include int main() {    int a = ... Read More

Advertisements