AmitDiwan has Published 10744 Articles

HTML DOM Input Date type Property

AmitDiwan

AmitDiwan

Updated on 15-Jun-2020 12:07:02

120 Views

The HTML DOM Input Date type property returns/sets type of Input Date.SyntaxFollowing is the syntax −Returning string valueinputDateObject.typeSetting type to string valueinputDateObject.type = stringValueString ValuesHere, “stringValue” can be the following −stringValueDetailsdateIt defines that input type is dateradioIt defines that input type is radiocheckboxIt defines that input type is checkboxExampleLet us ... Read More

HTML DOM Parameter Object

AmitDiwan

AmitDiwan

Updated on 13-Jun-2020 10:59:14

146 Views

The HTML DOM Parameter Object represent the element of an HTML document.Create param objectSyntaxFollowing is the syntax −document.createElement(“PARAM”);Properties of param objectPropertyExplanationnameIt returns and modify the value of the name attribute of a param element in an HTML document.valueIt returns and modify the content of the value attribute of a ... Read More

HTML DOM Input Date step Property

AmitDiwan

AmitDiwan

Updated on 13-Jun-2020 10:49:14

256 Views

The HTML DOM Input Date step property determines the legal day intervals to choose from when user opens the calendar. It sets or returns the input date step attribute value.SyntaxFollowing is the syntax −Returning number valueinputDateObject.stepSetting value attribute to a number valueinputDateObject.step = numberExampleLet us see an example of Input Date step ... Read More

How to move an array of embedded documents up to parent and change key/value with aggregation pipeline?

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:26:12

1K+ Views

Use $replaceRoot in MongoDB aggregation. The $replaceRoot replaces the input document with the specified document. The operation replaces all existing fields in the input document, including the _id field. Let us create a collection with documents −> db.demo733.insertOne( ...    { ...       "SubjectDetails": ...       ... Read More

How to add a field with specific datatype (list, object) in an existing MongoDB document?

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:23:53

464 Views

You can use $set. Let us create a collection with documents −> db.demo732.insertOne({_id:1, Language:"English"}); { "acknowledged" : true, "insertedId" : 1 } > db.demo732.insertOne({_id:2, Language:"Hindi"}); { "acknowledged" : true, "insertedId" : 2 }Display all documents from a collection with the help of find() method −> db.demo732.find();This will produce the following ... Read More

How to display a specific field in array using $project in MongoDB and ignore other fields?

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:22:15

871 Views

To display a specific field, use $project along with $unwind. To ignore a field, set to 0. Let us create a collection with documents −> db.demo731.insertOne({ "ProductInformation": [ { ProductId:"Product-1", ProductPrice:80 }, { ProductId:"Product-2", ProductPrice:45 }, { ProductId:"Product-3", ProductPrice:50 } ] } ); {    "acknowledged" : true,    "insertedId" ... Read More

Match MongoDB documents with field value greater than a specific number and fetch them?

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:20:25

494 Views

To match, use $match in MongoDB. For values greater than a specific number, use $gt. Let us create a collection with documents −> db.demo730.insertOne({"Name" : "Chris", "Marks" : 33 }); {    "acknowledged" : true,    "insertedId" : ObjectId("5eac54cd56e85a39df5f6339") } > db.demo730.insertOne({ "Name" : "David", "Marks" : 89}); {   ... Read More

Mass insertion in MongoDB

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:18:39

121 Views

For mass insertion, use the concept of insertMany() in MongoDB. The insertMany() inserts multiple documents into a collection.Let us create a collection with documents −> db.demo729.insertMany( [ ...    { BankName:"HDFC Bank", cardType:"Credit", "CustomerName":[{Name:"Chris", Age:25}]}, ...    { BankName:"ICICI Bank", cardType:"Debit", "CustomerName":[{Name:"Bob", Age:22}]}, ...    { BankName:"Kotak Bank", cardType:"Debit", "CustomerName":[{Name:"David", ... Read More

Find MongoDB records with Price less than a specific value

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:16:20

380 Views

To check the records with Price less than a specific value, use $lt. Let us create a collection with documents −> db.demo728.insertOne({Price:75}); {    "acknowledged" : true,    "insertedId" : ObjectId("5eab413c43417811278f589b") } > db.demo728.insertOne({Price:59}); {    "acknowledged" : true,    "insertedId" : ObjectId("5eab414043417811278f589c") } > db.demo728.insertOne({Price:79}); {    "acknowledged" : ... Read More

MongoDB query to search for string like “@email” in the field values

AmitDiwan

AmitDiwan

Updated on 15-May-2020 09:14:43

1K+ Views

Search for email string using MongoDB find(). Let us create a collection with documents −> db.demo727.insertOne({UserId:"John@email.com"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5eab375f43417811278f5898") } > db.demo727.insertOne({UserId:"John@yahoo.com"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5eab376043417811278f5899") } > db.demo727.insertOne({UserId:"Chris@EMAIL.com"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5eab376143417811278f589a") }Display ... Read More

Advertisements