Nishtha Thakur has Published 495 Articles

Can MongoDB return result of increment?

Nishtha Thakur

Nishtha Thakur

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

150 Views

Yes, you can achieve this with findAndModify(). Let us first create a collection with documents −> db.returnResultOfIncementDemo.insertOne({"PlayerScore":98}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3c292edc6604c74817cda") }Following is the query to display all documents from a collection with the help of find() method −> db.returnResultOfIncementDemo.find();This will produce the following output ... Read More

How to set values to list of parameters of IN clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

The IN clause in MYSQL database is used to specify the list of parameters in a query.For example, you need to retrieve contents of a table using specific IDs you can do so using the SELECT statement along with the IN clause as −mysql> SELECT * from sales where ID ... Read More

How to check if a field in MongoDB is [] or {}?

Nishtha Thakur

Nishtha Thakur

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

190 Views

To check if a field in MongoDB is [] or {}, you can use the following syntax −db.yourCollectionName.find({    "yourOuterFieldName": { "$gt": {} },    "yourOuterFieldName.0": { "$exists": false } });Let us first create a collection with documents -> db.checkFieldDemo.insert([ ...   { _id: 1010, StudentDetails: {} }, ...   ... Read More

How to pass a value in where clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

To execute a statement with Where clause using PreparedStatement. Prepare the query by replacing the value in the clause with place holder “?” and, pass this query as a parameter to the prepareStatement() method.String query = "SELECT * FROM mobile_sales WHERE unit_sale >= ?"; //Creating the PreparedStatement object PreparedStatement pstmt ... Read More

Extending namespace and Unnamed namespace

Nishtha Thakur

Nishtha Thakur

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

340 Views

Here we will see how we can extend some namespace, and how the unnamed or anonymous name space can be used.Sometimes we can define one namespace. Then we can write the namespace again with the same definition. If the first one has some member, and second one has some other ... Read More

How to change notification background colour in Android?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

This example demonstrate about How can I marquee the text content in 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

MongoDB pull with positional operator?

Nishtha Thakur

Nishtha Thakur

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

205 Views

Use $pull operator along with positional operator($) in MongoDB. Let us first create a collection with documents −> db.pullWithPositionalOperatorDemo.insertOne( ...   { ...      _id: 100, ...      "StudentDetails": [ ...         { ...            "StudentId": "STU-1", ...       ... Read More

How to store decimal values in a table using PreparedStatement in JDBC?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To insert records into a table that contains a decimal value using PreparedStatement you need to −Register the driver − Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection − Connect ot the database using the ... Read More

Hiding of all overloaded methods in base class in C++

Nishtha Thakur

Nishtha Thakur

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

600 Views

In C++, we can use the function overloading techniques. But if some base class has one method in overloaded form (different function signature with the same name), and the derived class redefines one of the function which is present inside the base, then all of the overloaded version of that ... Read More

Batch Inserts Using JDBC Prepared Statements

Nishtha Thakur

Nishtha Thakur

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

6K+ Views

Grouping a set of INSERT Statements and executing them at once is known as batch insert.Batch inserts using PreparedStatement objectTo execute a batch of insert statements using the PreparedStatement object −Create a PreparedStatement − Create a PreparedStatement object using the prepareStatement() method. Pass the Insert query with place holders “?” ... Read More

Advertisements