AmitDiwan has Published 10744 Articles

How to create a chat message with CSS?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 10:55:35

430 Views

To create a chat message with CSS, the code is as follows −Example Live Demo    body {       margin: 0 auto;       max-width: 800px;       padding: 0 20px;       font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;    } ... Read More

How to create a typing effect with JavaScript?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 10:50:45

274 Views

To create a typing effect with JavaScript, the code is as follows −Example Live Demo    body{       font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;    }    button{       padding:10px;       font-size: 18px;       background-color: rgb(128, 19, 218);   ... Read More

How to create a countdown timer with JavaScript?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 10:48:00

668 Views

To create a countdown timer with JavaScript, the code is as follows −Example Live Demo    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .timer {       text-align: center;       font-size: 60px;       margin-top: ... Read More

How to use icons to make an animated effect with JavaScript?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 10:45:00

347 Views

To use icons to make animated effect, the code is as follows −Example Live Demo    #user {       font-size: 60px;       color:rgb(106, 33, 201);    }    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;       padding: ... Read More

MongoDB query to fetch random value using Map Reduce concept.

AmitDiwan

AmitDiwan

Updated on 12-May-2020 09:02:03

296 Views

For random value with Map Reduce, use mapReduce() concept along with Math.random(). Let us create a collection with documents −> db.demo651.insertOne({Value:10}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e9f0330e3c3cd0dcff36a57") } > db.demo651.insertOne({Value:20}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e9f0332e3c3cd0dcff36a58") } > db.demo651.insertOne({Value:30}); {    "acknowledged" : true, ... Read More

Querying only the field name and display only the id in MongoDB?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 08:57:02

872 Views

To query only the field name, set fieldName to 0 i.e. the fieldName to hide. Let us create a collection with documents −> db.demo650.insertOne({_id:101, details:{Name:"Chris", Age:21}}); { "acknowledged" : true, "insertedId" : 101 } > db.demo650.insertOne({_id:102, details:{Name:"Bob", Age:22}}); { "acknowledged" : true, "insertedId" : 102 } > db.demo650.insertOne({_id:103, details:{Name:"Sam", Age:20}}); ... Read More

MongoDB aggregation group and remove duplicate array values?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 08:55:19

3K+ Views

Use MongoDB aggregate for this and within that, use $group. Let us create a collection with documents −> db.demo649.insertOne( ...    { "_id" : 101, "Names" : [ "John", "Bob", "Bob", "Robert" ], "CountryName" : "US" } ... ); { "acknowledged" : true, "insertedId" : 101 } > > db.demo649.insertOne({ ... Read More

Create and display the newly created database in MongoDB?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 08:53:29

122 Views

To create a new database, you need to use the USE command as in the below syntax −use yourDatabaseName;To show all databases, you need to use show command. The syntax is as follows −show dbs;Let us implement the above syntax in order to create database −> use onlinecustomertracker; switched to ... Read More

Perform nested document value search in MongoDB?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 08:50:43

146 Views

For searching value, use $match in MongoDB. Let us create a collection with documents −> db.demo648.insertOne( ...    { ...       StudentInformation: ...       [ ...          { ...             Name:"John", ...             ... Read More

MongoDB aggregation to combine or merge fields and then count?

AmitDiwan

AmitDiwan

Updated on 12-May-2020 08:47:14

632 Views

To combine or merge fields and then perform count, use $group along with $sum and $sort. Let us create a collection with documents −> db.demo647.insertOne({"Subject":"MySQL"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e9c86316c954c74be91e6ee") } > db.demo647.insertOne({"Subject":"MongoDB"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e9c86356c954c74be91e6ef") } > db.demo647.insertOne({"Subject":"MySQL"}); { ... Read More

Advertisements