Ankith Reddy has Published 996 Articles

How to find a record by _id in MongoDB?

Ankith Reddy

Ankith Reddy

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

662 Views

In order to find record by _id in MongoDB, you can use the following syntaxdb.yourCollectionName.find({"_id":yourObjectId});Let us create a collection with documents> db.findRecordByIdDemo.insertOne({"CustomerName":"Larry", "CustomerAge":26}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9dc2c875e2eeda1d5c3671") } > db.findRecordByIdDemo.insertOne({"CustomerName":"Bob", "CustomerAge":20}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9dc2d175e2eeda1d5c3672") } > db.findRecordByIdDemo.insertOne({"CustomerName":"Carol", "CustomerAge":22}); { ... Read More

DoubleStream of() method in Java

Ankith Reddy

Ankith Reddy

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

239 Views

The DoubleStream class in Java the following two forms of the of() methodThe following of() method returns a sequential DoubleStream containing a single element. Here is the syntaxstatic DoubleStream of(double t)Here, parameter t is the single element.The following of() method returns a sequential ordered stream whose elements are the specified ... Read More

MySQL query to GROUP BY multiple columns

Ankith Reddy

Ankith Reddy

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

813 Views

You can use IF() to GROUP BY multiple columns. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table MultipleGroupByDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> CustomerId int,    -> ProductName varchar(100) ... Read More

What is a response object in JSP?

Ankith Reddy

Ankith Reddy

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

1K+ Views

The response object is an instance of a javax.servlet.http.HttpServletResponse object. Just as the server creates the request object, it also creates an object to represent the response to the client.The response object also defines the interfaces that deal with creating new HTTP headers. Through this object, the JSP programmer can ... Read More

What's the difference between assignment operator and copy constructor in C++?

Ankith Reddy

Ankith Reddy

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

729 Views

The Copy constructor and the assignment operators are used to initialize one object to another object. The main difference between them is that the copy constructor creates a separate memory block for the new object. But the assignment operator does not make new memory space. It uses reference variable to ... Read More

What is Radio Group in android?

Ankith Reddy

Ankith Reddy

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

337 Views

Before getting into example, we should know, What is radio group in android. Radio Group contains group of radio buttons. Using radio buttons we can select and un select according to user requirements.This example demonstrate about how to use radio group in android.Step 1 − Create a new project in ... Read More

How to return only value of a field in MongoDB?

Ankith Reddy

Ankith Reddy

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

980 Views

In order to return only value of a field in MongoDB, you need to write a query and use forEach loop. Let us first create a collection with documents> db.returnOnlyValueOfFieldDemo.insertOne({"ClientName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ea537d628fa4220163b6e") } > db.returnOnlyValueOfFieldDemo.insertOne({"ClientName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ... Read More

ArrayBlockingQueue size() Method in Java

Ankith Reddy

Ankith Reddy

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

153 Views

To get the number of elements in the queue, use the size() method of the ArrayBlockingQueue class.The syntax is as followsint size()To work with ArrayBlockingQueue class, you need to import the following packageimport java.util.concurrent.ArrayBlockingQueue;The following is an example to implement size() method of Java ArrayBlockingQueue classExample Live Demoimport java.util.concurrent.ArrayBlockingQueue; public class ... Read More

What is the use of Cookie or hidden fields in JSP?

Ankith Reddy

Ankith Reddy

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

619 Views

CookiesA webserver can assign a unique session ID as a cookie to each web client and for subsequent requests from the client they can be recognized using the received cookie.This may not be an effective way as the browser at times does not support a cookie. It is not recommended ... Read More

Copy constructor vs assignment operator in C++

Ankith Reddy

Ankith Reddy

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

4K+ Views

The Copy constructor and the assignment operators are used to initializing one object to another object. The main difference between them is that the copy constructor creates a separate memory block for the new object. But the assignment operator does not make new memory space. It uses the reference variable ... Read More

Advertisements