Articles on Trending Technologies

Technical articles with clear explanations and examples

Difference between Hadoop and MongoDB

Pradeep Kumar
Pradeep Kumar
Updated on 15-Mar-2026 947 Views

Hadoop is a Java-based distributed computing framework designed to store and analyze large volumes of data across multiple computer clusters. It processes enormous amounts of structured and unstructured data through its core components: HDFS (Hadoop Distributed File System) for storage and MapReduce for parallel data processing. MongoDB is an open-source NoSQL document database that stores data in BSON format rather than traditional tables, rows, and columns. It's designed to solve performance, availability, and scalability issues of SQL-based databases by offering a flexible, document-oriented approach to data storage. What is Hadoop? Apache Hadoop is a distributed computing platform ...

Read More

SignUp form using Node and MongoDB

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

In this article, we will create a simple user sign-up form using Node.js and MongoDB. When users fill out the form and click submit, their details will be saved to the MongoDB database. Installation Before creating the sign-up form, install the following dependencies: Express - Web framework for Node.js to handle HTTP requests npm install express --save Body-parser - Middleware to parse HTTP POST data npm install body-parser --save Mongoose - MongoDB ...

Read More

Connecting MongoDB with NodeJS

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 2K+ Views

To connect MongoDB with Node.js, use the MongoClient.connect() method from the mongodb package. This asynchronous method establishes a connection between your Node.js application and the MongoDB server. Syntax MongoClient.connect(url, options, callback) Parameters: url − Connection string specifying the MongoDB server location and port options − Optional configuration object (e.g., useUnifiedTopology: true) callback − Function executed after connection attempt with error and client parameters Installation and Setup First, install the MongoDB driver for Node.js ? npm install mongodb --save Start your MongoDB server ? mongod --dbpath=data ...

Read More

Querying on an array of objects for specific nested documents with MongoDB?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

To query on an array of objects for nested documents in MongoDB, use the find() method with the $elemMatch operator in projection to return only matching array elements. Syntax db.collection.find( {}, { arrayField: { $elemMatch: { condition } } } ); Sample Data db.demo763.insertOne({ _id: 1, ...

Read More

MongoDB aggregation and projection?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

MongoDB aggregation with projection allows you to transform and reshape documents by selecting specific fields, computing new values, and controlling the output structure. The $project stage in the aggregation pipeline passes documents with requested fields to the next stage. Syntax db.collection.aggregate([ { $project: { field1: 1, // Include field field2: 0, // Exclude field ...

Read More

Check for duplicates in an array in MongoDB?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

To check for duplicates in an array in MongoDB, use the $unwind and $group operators within an aggregation pipeline to identify array elements that appear more than once in the same document. Syntax db.collection.aggregate([ { $project: { arrayField: 1 } }, { $unwind: "$arrayField" }, { $group: { _id: { _id: "$_id", value: "$arrayField" }, count: { $sum: 1 } } }, { $match: { count: { $gt: 1 } } }, { $group: { _id: "$_id._id", ...

Read More

Sort MongoDB field which contains both integer and decimal values?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 448 Views

To sort a MongoDB field containing both integer and decimal values, use the sort() method. MongoDB automatically handles mixed numeric types (integers and decimals) in the same field and sorts them by their numeric value. Syntax db.collection.find().sort({fieldName: 1}); // 1 for ascending, -1 for descending Sample Data db.demo755.insertMany([ {"Value": 10}, {"Value": 10.5}, {"Value": 9.5}, {"Value": 12.5}, {"Value": 11.5}, {"Value": 6} ]); { ...

Read More

How to convert birth date records to age with MongoDB

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

To convert birth date records to age in MongoDB, use the $dateDiff operator or calculate the difference between the current date and birth date using $subtract and $divide operators in an aggregation pipeline. Syntax db.collection.aggregate([ { $project: { age: { $divide: [ ...

Read More

Filter specific values from a MongoDB document

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 640 Views

To filter specific values from a MongoDB document, use the $filter operator in aggregation pipelines. This operator allows you to select array elements that match specific conditions and return only those elements. Syntax { $filter: { input: "$arrayField", as: "variable", cond: { condition } } } Sample Data db.demo751.insertOne({ _id: 101, details: [ ...

Read More

How to get max values for distinct elements in MongoDB

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 776 Views

To get max values for distinct elements in MongoDB, use the $group operator with $max to find the highest value for each distinct element. This aggregation pipeline groups documents by a field and returns the maximum value within each group. Syntax db.collection.aggregate([ { $group: { _id: "$fieldName", maxValue: { $max: "$valueField" } } ...

Read More
Showing 22771–22780 of 61,297 articles
Advertisements