Nishtha Thakur has Published 495 Articles

How to search for documents based on the value of adding two properties in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

135 Views

You can use aggregate framework for this. Here, we will get the sum and then match it to search for documents less than a particular number. Let us first create a collection with documents −> db.searchDocumentsDemo.insertOne({"Value1":100, "Value2":560}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3fe1eedc6604c74817ce9") } > db.searchDocumentsDemo.insertOne({"Value1":300, "Value2":150}); ... Read More

How to set Large icon instead of small icon on Android Notification?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

This example demonstrate about How to set Large icon instead of small icon on Android Notification .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

How to create JSplitPane to divide components in Java?

Nishtha Thakur

Nishtha Thakur

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

282 Views

At first, set two components which we will dividing −JComponent one = new JLabel("Label One"); one.setBorder(BorderFactory.createLineBorder(Color.yellow)); JComponent two = new JLabel("Label Two"); two.setBorder(BorderFactory.createLineBorder(Color.orange));Now, split it using SplitPane −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSplitPane; public class SwingDemo {    public static ... Read More

How to get a specific object from array of objects inside specific MongoDB document?

Nishtha Thakur

Nishtha Thakur

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

459 Views

To get specific object from array of objects, use positional operator($). Let us first create a collection with documents −> db.getASpecificObjectDemo.insertOne( ...   { ...      _id :1, f ...      "CustomerName" : "Larry", ...      "CustomerDetails" : { ...         "CustomerPurchaseDescription": [{ ... ... Read More

How to give emojis support in Android push notification?

Nishtha Thakur

Nishtha Thakur

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

528 Views

This example demonstrate about How to give emojis support in Android push notificationStep 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.     Step 3 ... Read More

Add a field to an embedded document in an array in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

520 Views

You can use update() along with $ operator for this. Let us first create a collection with documents −> db.addAFieldDemo.insertOne( ...   { ... ...      "ClientName" : "Larry", ...      "ClientCountryName" : "US", ...      "ClientOtherDetails" : [ ...         { ...   ... Read More

How do I check to see if a column name exists in a CachedRowSet in JDBC?

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

CachedRowSet interface does not provide any methods to determine whether a particular column exists.Therefore, to find whether a RowSet contains a specific column, you need to compare the name of each column in the RowSet with the required name. To do so −Retrieve the ResultSetMetaData object from the RowSet using ... Read More

How to check if an Android app is allowed to show notification?

Nishtha Thakur

Nishtha Thakur

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

249 Views

This example demonstrate about Android NotificationBuilder.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.     Step 3 − Add the following code to ... Read More

How to get this node’s last child in a JTree with Java?

Nishtha Thakur

Nishtha Thakur

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

316 Views

Let’s say we want the last child node of a node, then use the getLastChild() method −node3.getFirstChild()Display the node’s last child on Console −System.out.println("The last child of node 3 = "+node3.getLastChild());The following is an example to get this node’s last child in a JTree −Examplepackage my; import javax.swing.JFrame; import javax.swing.JTree; ... Read More

Query Array for 'true' value at index n in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

172 Views

You can use dot(.) notation for this. Let us first create a collection with documents −>db.containsTrueValueDemo.insertOne({"IsMarried":[true, false, true, true, true, true, false, true, false, false, true]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd5039c2cba06f46efe9ef5") }Following is the query to display all documents from a collection with the help of ... Read More

Advertisements