Smita Kapse has Published 560 Articles

How to find through list of ids in MongoDB?

Smita Kapse

Smita Kapse

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

1K+ Views

You can use $in operator to find through the list of ids in MongoDB. 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.findListOfIdsDemo.insertOne({"StudentName":"Carol", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8ecadd2f684a30fbdfd575") ... Read More

How to replace substring in MongoDB document?

Smita Kapse

Smita Kapse

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

816 Views

In order to replace substring in MongoDB document, you can use the replace() function. To understand it further, let us create a collection with document. The query to create a collection with document is as follows −> db.replaceSubstringDemo.insertOne({"WebsiteURL":"www.gogle.com"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c76eaf21e9c5dd6f1f78276") }Display all documents ... Read More

How to use substring () in Android textview?

Smita Kapse

Smita Kapse

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

1K+ Views

This example demonstrate about How to use substring () in Android textview.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

Find documents with arrays not containing a document with a particular field value in MongoDB?

Smita Kapse

Smita Kapse

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

613 Views

You can use $nin 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.documentWithAParticularFieldValueDemo.insertOne(    ... {       ...       ... "StudentId" : 101,       ... Read More

C++ Program to Construct a Random Graph by the Method of Random Edge Selection

Smita Kapse

Smita Kapse

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

91 Views

In this program a random graph is generated for random vertices and edges. The time complexity of this program is O(v*e). Where v is the number of vertices and e is the number of edges.AlgorithmBegin    Develop a function GenRandomGraphs(), with ‘e’ as the    number of edges and ‘v’ ... Read More

How does #include work in C++?

Smita Kapse

Smita Kapse

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

2K+ Views

The is a header file. This file includes all standard library. Sometimes in some coding contests, when we have to save time while solving, then using this header file is helpful.In software engineering approach we should reduce the minimize the include. Using this header file, it will include lots ... Read More

How to use trim () in Android textview?

Smita Kapse

Smita Kapse

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

2K+ Views

This example demonstrate about How to use trim () in Android textview.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

Find MongoDB records where array field is not empty?

Smita Kapse

Smita Kapse

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

2K+ Views

You can use $ne(Not Equal) operator for this. To understand the concept, let us create a collection with document. The query to create a collection with document is as follows −> db.arrayFieldIsNotEmptyDemo.insertOne({"StudentName":"Larry", "StudentTechnicalSubject":["Java", "C"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c76fe2f1e9c5dd6f1f78291") } > db.arrayFieldIsNotEmptyDemo.insertOne({"StudentName":"Mike", "StudentTechnicalSubject":[]}); {    "acknowledged" ... Read More

Deleting all records of a collection in MongoDB Shell?

Smita Kapse

Smita Kapse

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

576 Views

To delete all records of a collection in MongoDB shell, use the remove() method. The syntax is as follows −db.yourCollectionName.remove({});To understand the syntax, let us create a collection with document. The query to create a collection with document is as follows −> db.deleteAllRecordsDemo.insertOne({"StudentName":"John"}); {    "acknowledged" : true,    "insertedId" ... Read More

How to find minimum value in MongoDB?

Smita Kapse

Smita Kapse

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

984 Views

To find the minimum value in MongoDB, you can use sort() along with limit(1). The syntax is as follows −db.yourCollectionName.find().sort({yourFieldName: 1}).limit(1);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.findMinValueDemo.insertOne({"StudentMarks":78}); {    "acknowledged" : ... Read More

Advertisements