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; text-align: center; padding: 14px; color: rgb(178, 137, 253); text-decoration: none; font-size: 17px; } .links:hover { background-color: rgb(100, 100, 100); } .selected{ background-color: rgb(0, 18, 43); } @media screen and (max-width: 600px) { .links { display: block; } } Home Login Register Contact Us More Info OutputThe above code will produce the following output −When the screen will be resized to 600px −
Following is the code to create a responsive navigation menu with a login form inside of it −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; text-align: center; padding: 14px; color: rgb(178, 137, 253); text-decoration: none; font-size: 17px; } .links:hover { background-color: rgb(100, 100, 100); } form { float: right; margin-top: 8px; } form input{ display: inline-block; ... Read More
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 −
Java 9 introduced an interactive REPL command-line tool named JShell. It allows us to execute Java code snippets and get immediate results. We can import external classes that can be accessed from a JShell session through the classpath. The Gson library is a Java serialization/deserialization library intended for converting Java Objects into JSON and vice-versa.In the below code snippet, we can set the classpath in JShelljshell> /env --class-path C:\Users\User\gson.jar | Setting new options and restoring state.Once we have imported the gson library in JShell, able to see that library in the list.jshell> import com.google.gson.* jshell> /import | import java.io.* | import java.math.* | ... Read More
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 }) => { ... op1.push({ ... "updateOne": { ... "filter": { Name}, ... "update": { "$set": { Value1, Value2, Name } }, ... "upsert": true ... } ... }) ... }); > db.demo397.bulkWrite(op1); ... Read More
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"}); { "acknowledged" : true, "insertedId" : ObjectId("5e5e782317aa3ef9ab8ab208") }Display all documents from a collection with the help of find() method −> db.demo395.find();This will produce the following output −{ "_id" : ObjectId("5e5e782317aa3ef9ab8ab207"), "Name" : "Chris" } { "_id" : ObjectId("5e5e782317aa3ef9ab8ab208"), "Name" : "David" }Let us create a second collection with documents ... Read More
Let us first create a collection with documents −> db.demo394.insertOne( ... { ... ... details: [ ... { ... _id: '1', ... startDate: '2018-01-11T07:00:00.000Z', ... endDate: '2019-01-12T07:59:59.999Z' ... }, ... { ... _id: '2', ... startDate: '2019-01-21T07:00:00.000Z', ... endDate: '2020-01-04T07:59:59.999Z' ... } ... ] ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e5e716817aa3ef9ab8ab202") }Display all ... Read More
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") } > db.demo393.insertOne( ... { ... Id1: "1", ... Name: "Chris", ... Id2: "101" ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e5e6dd522064be7ab44e805") } > db.demo393.insertOne( ... { ... Id1: "3", ... ... Read More
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' ... ... }, ... { ... _id: '102' ... } ... ] ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5e5d2b3322064be7ab44e802") } > > db.demo392.insertOne( ... Read More
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" : 101 } > db.demo391.insertOne( ... { "_id" : 111, "Name" : "Chris", Values: ["101", "102"] } ... ) { "acknowledged" : true, "insertedId" : 111 } > db.demo391.insertOne( ... { "_id" : 121, "Name" : "Chris", Values: ["101", "102"] } ... ) { "acknowledged" : true, "insertedId" : ... Read More