Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Nancy Den
Page 5 of 18
Arrow to the bottom of the tooltip with CSS
In CSS, you can create a tooltip with an arrow pointing to the bottom by using the ::after pseudo-element to generate a triangular shape. This is achieved by manipulating border properties to create the arrow effect. Syntax .tooltip .tooltip-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -border-width; border-width: size; border-style: solid; border-color: tooltip-color transparent transparent transparent; } Example The ...
Read MoreRotate In Down Left Animation Effect with CSS
The CSS rotateInDownLeft animation effect creates a smooth rotation entrance animation where an element rotates from a -90 degree angle to its normal position while fading in. The rotation occurs from the bottom-left corner of the element. Syntax @keyframes rotateInDownLeft { 0% { transform-origin: left bottom; transform: rotate(-90deg); opacity: 0; } 100% { ...
Read MoreFlip Animation Effect with CSS
The CSS flip animation effect creates a 3D rotation that makes an element appear to turn over or flip around its Y-axis. This effect uses CSS transforms and keyframes to create smooth, eye-catching animations. Syntax selector { animation: flip duration timing-function; transform: perspective(distance) rotateY(angle); } Example The following example demonstrates a flip animation effect that rotates an element 360 degrees with perspective − .flip-container { width: 200px; ...
Read MoreConverting string to date in MongoDB?
To convert the string to date in MongoDB, use the $dateFromString operator within an aggregation pipeline. This operator parses a string and converts it to a proper date object. Syntax db.yourCollectionName.aggregate([ { $project: { anyVariableName: { $dateFromString: { ...
Read MoreGroup by dates in MongoDB?
You can use the aggregate framework to group by dates in MongoDB. The aggregation pipeline provides powerful date operators to group documents by specific date components like day, month, or year. Sample Data Let us first create a collection with some documents containing date fields ? db.groupByDateDemo.insertMany([ {"UserLoginDateTime": new ISODate()}, {"UserLoginDateTime": new ISODate("2019-01-31T15:20:09.234Z")}, {"UserLoginDateTime": new ISODate("2017-04-21T16:12:13.240Z")}, {"UserLoginDateTime": new ISODate("2016-05-25T19:11:21.130Z")}, {"UserLoginDateTime": new ISODate("2016-05-25T19:11:21.130Z")}, {"UserLoginDateTime": new ISODate()} ]); Display all documents from ...
Read MoreHow to change the type of a field in MongoDB?
MongoDB allows you to change the data type of existing fields using update operations with type conversion functions. Let us convert a string type field to number type using the parseInt() function with an update query. Sample Data First, create a collection with a document containing different data types ? db.changeDataType.insertOne({ "StudentName": "Larry", "StudentAge": 23, "StudentZipCode": "10001", "isProgrammer": false }); { "acknowledged": true, "insertedId": ObjectId("5c6ed4976fd07954a4890694") } Display ...
Read MoreHow to get the last N records in MongoDB?
To get the last N records in MongoDB, you need to use limit() method combined with sorting. The $natural parameter sorts documents in reverse insertion order, and limit() restricts the number of returned records. Syntax db.yourCollectionName.find().sort({$natural:-1}).limit(yourValue); Sample Data To understand the above syntax, let us create a collection with documents. The query to create a collection with documents is as follows ? db.getLastNRecordsDemo.insertMany([ {"EmployeeName": "Maxwell"}, {"EmployeeName": "Carol"}, {"EmployeeName": "Bob"}, {"EmployeeName": "Sam"}, {"EmployeeName": ...
Read MoreHow do you remove an array element by its index in MongoDB
To remove an array element by its index in MongoDB, you can use the $unset and $pull operators in a two-step process. The $unset operator sets the array element at the specified index to null, and the $pull operator removes all null values from the array. Syntax db.yourCollectionName.update({}, {$unset: {"yourArrayListName.yourPosition": yourPositionValue}}); db.yourCollectionName.update({}, {$pull: {"yourArrayListName": null}}); Sample Data Let us create a collection with a document to demonstrate the removal process ? db.removeArrayElements.insertOne({ "StudentName": "Larry", "StudentAge": 23, "TechnicalSubject": ["C", "C++", "Java", ...
Read MoreQuery for documents where array size is greater than 1 in MongoDB?
There are multiple ways to query documents where an array field has more than a certain number of elements in MongoDB. The recommended approaches are $expr with $size, or the dot notation trick with $exists. Sample Data db.students.insertMany([ {"StudentName": "Larry", "Subjects": ["Java", "C", "C++"]}, {"StudentName": "Maxwell", "Subjects": ["MongoDB"]}, {"StudentName": "Carol", "Subjects": ["MySQL", "SQL Server", "PL/SQL"]} ]); Method 1: Using $expr with $size (Recommended) db.students.find({ $expr: { $gt: [{ $size: "$Subjects" }, 1] } }).pretty(); ...
Read MoreHow to filter array in subdocument with MongoDB?
To filter elements within an array subdocument in MongoDB, you can use $unwind + $match in an aggregation pipeline, or the more concise $filter operator (MongoDB 3.2+). Sample Data db.filterArray.insertOne({ "L": [{"N": 1}, {"N": 2}, {"N": 3}, {"N": 4}, {"N": 5}] }); Method 1: Using $unwind + $match + $group Unwind the array, filter matching elements, then regroup ? db.filterArray.aggregate([ { $match: { _id: ObjectId("5c6d63f2734e98fc0a434aeb") } }, { $unwind: "$L" }, { $match: { "L.N": { ...
Read More