Smita Kapse has Published 498 Articles

How to use substring () in Android textview?

Smita Kapse

Smita Kapse

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

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

899 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

170 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 to use trim () in Android textview?

Smita Kapse

Smita Kapse

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

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

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

701 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

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

Delete all elements in an array field in MongoDB?

Smita Kapse

Smita Kapse

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

2K+ Views

You can use $set operator for this. The syntax is as follows −db.yourCollectionName.update({}, { $set : {"yourFieldName": [] }} , {multi:true} );To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.deleteAllElementsInArrayDemo.insertOne({"InstructorName":"Larry", "InstructorTechnicalSubject":["Java", "MongoDB"]}); ... Read More

How to perform ascending order sort in MongoDB?

Smita Kapse

Smita Kapse

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

250 Views

To sort in ascending order, the syntax is as follows −db.yourCollectionName.find().sort({yourField: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.sortingDemo.insertOne({"Value":100}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8f8e2ed3c9d04998abf006") } > db.sortingDemo.insertOne({"Value":1}); {   ... Read More

In MongoDB how do you use $set to update a nested value/embedded document?

Smita Kapse

Smita Kapse

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

1K+ Views

The syntax is as follows for this −db.yourCollectionName.update({ }, { $set: { "yourOuterFieldName.yourInnerFieldName": "yourValue" } });To understand the syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.updateNestedValueDemo.insertOne({"CustomerName":"Chris",    ... "CustomerDetails":{"CustomerAge":25, "CustomerCompanyName":"Google", "CustomerCityName":"US"}}); {    "acknowledged" : ... Read More

Advertisements