Chandu yadav has Published 1163 Articles

Building Multiple Indexes at once in MongoDB?

Chandu yadav

Chandu yadav

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

1K+ Views

In order to build multiple indexes at once, you need to use createIndexes() and pass multiple keys into an array. Following is the query for building multiple indexes at once.>db.multipleIndexesDemo.createIndexes([{"First":1}, {"Second":1}, {"Third":1}, {"Fourth":1}, {"Fifth":1}]);This will produce the following output{    "createdCollectionAutomatically" : true,    "numIndexesBefore" : 1,    "numIndexesAfter" : ... Read More

How to find capital letters with Regex in MySQL?

Chandu yadav

Chandu yadav

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

375 Views

You can use REGEXP BINARY for thisselect *from yourTableName where yourColumnName REGEXP BINARY '[A-Z]{2}';Let us first create a tablemysql> create table FindCapitalLettrsDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentFirstName varchar(20)    -> ); Query OK, 0 rows affected (0.52 sec)Insert some records ... Read More

C++ Program to Print “Even” or “Odd” without using conditional statement

Chandu yadav

Chandu yadav

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

3K+ Views

In this section we will see how to check whether a number is odd or even without using any kind of conditional statements like (=, ==).We can easily check the odd or even by using the conditional statements. We can divide the number by 2, then check whether the remainder ... Read More

Get the average of an entire field using the aggregation framework in MongoDB?

Chandu yadav

Chandu yadav

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

80 Views

You can use aggregate() method for this. Let us first create a collection with documents> db.averageAggregationDemo.insertOne({"PlayerGameScore":45}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ed66bd628fa4220163b95") } > db.averageAggregationDemo.insertOne({"PlayerGameScore":55}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ed671d628fa4220163b96") } > db.averageAggregationDemo.insertOne({"PlayerGameScore":65}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ed676d628fa4220163b97") } ... Read More

C++ program to generate random number

Chandu yadav

Chandu yadav

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

4K+ Views

Let us see how to generate random numbers using C++. Here we are generating a random number in range 0 to some value. (In this program the max value is 100).To perform this operation we are using the srand() function. This is in the C library. The function void srand(unsigned ... Read More

What is a pageContext Object in JSP?

Chandu yadav

Chandu yadav

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

1K+ Views

The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.This object is intended as a means to access information about the page while avoiding most of the implementation details.This object stores references to the request and response objects for ... Read More

Query MongoDB for a datetime value less than NOW?

Chandu yadav

Chandu yadav

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

584 Views

You can use $lte operator along with new Date() for this. Let us first create a collection with documents>db.dateTimeValueLessThanNowDemo.insertOne({"CustomerName":"Larry", "CustomerProductName":"Product-1", "ArrivalDate":new ISODate("2017-01-31")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca1e8ab66324ffac2a7dc59") } >db.dateTimeValueLessThanNowDemo.insertOne({"CustomerName":"Mike", "CustomerProductName":"Product-2", "ArrivalDate":new ISODate("2019-04-01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca1e8c166324ffac2a7dc5a") } >db.dateTimeValueLessThanNowDemo.insertOne({"CustomerName":"Chris", "CustomerProductName":"Product-3", "ArrivalDate":new ISODate("2019-03-31")}); ... Read More

8086 program to subtract two 16 bit BCD numbers

Chandu yadav

Chandu yadav

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

1K+ Views

In this program we will see how to subtract two 16-bit BCD numbers.Problem StatementWrite 8086 Assembly language program to subtract two 16-bit BCD numbers stored in memory offset 500H – 501H and 502H – 503H.DiscussionHere we are adding the 16-bit data byte by byte. At first we are subtracting lower ... Read More

What is a page object in JSP?

Chandu yadav

Chandu yadav

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

297 Views

This object is an actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page.The page object is really a direct synonym for the this object.

Set Ennead value in JavaTuples

Chandu yadav

Chandu yadav

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

82 Views

To set Ennead value in Java, you need to use the setAtX() method. Here, X represents the index wherein you need to set the value i.e. for index 1, use setAt1() method. Set the value as the parameter value of the method.Let us first see what we need to work ... Read More

Advertisements