AmitDiwan has Published 8359 Articles

How to create a Hoverable Sidenav with CSS?

AmitDiwan

AmitDiwan

Updated on 03-Apr-2020 09:09:33

418 Views

Following is the code to create hoverable side navigation buttons with CSS.Example Live Demo Document nav a {    position: fixed;    left: -120px;    transition: 0.3s;    padding: 10px;    width: 140px;    text-decoration: none;    font-size: 20px;    color: black;    font-weight: bolder;   ... Read More

How to create a responsive side navigation menu with CSS?

AmitDiwan

AmitDiwan

Updated on 03-Apr-2020 08:51:56

867 Views

Following is the code to create a responsive side navigation menu with CSS −Example Live Demo body {    margin: 0;    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } nav {    margin: 0;    padding: 0;    width: 150px;    background-color: #2f77e4;    position: fixed; ... Read More

How to create a responsive navigation menu with icons, using CSS?

AmitDiwan

AmitDiwan

Updated on 03-Apr-2020 08:10:39

866 Views

Following is the code for creating the responsive navigation menu with icons.Example Live Demo Document body{    margin:0px;    margin-top:10px;    padding: 0px; } nav{    width: 100%;    background-color: rgb(39, 39, 39);    overflow: auto;    height: auto; } .links {    display: inline-block;   ... Read More

How to create a Menu Icon with CSS?

AmitDiwan

AmitDiwan

Updated on 03-Apr-2020 07:30:34

984 Views

To create a Menu Icon with CSS, the code is as follows −Example Live Demo div {    width: 40px;    height: 7px;    background-color: blue;    margin: 5px 2px; } > Sample Menu Icon OutputThis will produce the following output −

MongoDB query to add multiple documents

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:31:11

255 Views

To perform multiple write operations, use bulkWrite(). Let us create an array list values. Following is the query −> const arrayList = [ ...    {"Value1":100, "Value2":200, "Name": "John"}, ...    {"Value1":100, "Value2":200, "Name": "Bob"} ... ]; > let op1 = []; > arrayList.forEach(({ Value1, Value2, Name }) => { ... Read More

Perform $lookup to array of object id's in MongoDB?

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:28:05

2K+ Views

For this, use $lookup. This performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for processing.Let us first create a collection with documents −> db.demo395.insertOne({Name:"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e5e782317aa3ef9ab8ab207") } > db.demo395.insertOne({Name:"David"}); { ... Read More

MongoDB query to collectively match intersection of documents against a field

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:21:18

408 Views

For this, use aggregate(). Let us first create a collection with documents −> db.demo393.insertOne( ...    { ...       Id1: "1", ...       Name: "Chris", ...       Id2: "100" ...    } ... ); {    "acknowledged" : true,    "insertedId" : ObjectId("5e5e6dd522064be7ab44e804") } ... Read More

MongoDB query to pull multiple values from array

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:16:43

573 Views

To pull values, use $pull and set multi: true. Let us first create a collection with documents −> db.demo392.insertOne( ...    { ...       Name: 'Chris', ...       details: [ ...          { ...             _id: '101' ... ... Read More

Get a single element from the array of results by index in MongoDB

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:12:59

572 Views

To get a single element, use aggregation and LIMIT. The skip() is used to skip a specific number of documents.Let us first create a collection with documents −> db.demo391.insertOne( ...    { "_id" : 101, "Name" : "Chris", Values: ["101", "102"] } ... ) { "acknowledged" : true, "insertedId" : ... Read More

Update values in multiple documents with multi parameter in MongoDB?

AmitDiwan

AmitDiwan

Updated on 02-Apr-2020 14:09:16

462 Views

You need to set multi to true. Include the option multi − true to update all documents that match the query criteria.Let us first create a collection with documents −> db.demo390.insertOne({"FirstName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e5d1f3a22064be7ab44e7fa") } > db.demo390.insertOne({"FirstName":"David"}); {    "acknowledged" : true,    "insertedId" ... Read More

Advertisements