Articles on Trending Technologies

Technical articles with clear explanations and examples

Get names of all keys in the MongoDB collection?

Nancy Den
Nancy Den
Updated on 14-Mar-2026 2K+ Views

Since MongoDB documents can have different structures (no fixed schema), getting all key names requires iterating over documents. There are multiple approaches depending on whether you need keys from one document or all documents. Method 1: Using JavaScript Loop (Single Document) Use findOne() to get a document and loop through its keys ? var doc = db.studentGetKeysDemo.findOne(); for (var key in doc) { print(key); } Sample Data db.studentGetKeysDemo.insertOne({ "StudentId": 1, "StudentName": "Larry", "StudentAge": 23, ...

Read More

How to query MongoDB with LIKE?

Nancy Den
Nancy Den
Updated on 14-Mar-2026 2K+ Views

MongoDB does not have a LIKE operator like SQL. Instead, use regular expressions (regex) or the $regex operator for pattern matching. Syntax // Using regex literal (equivalent to SQL LIKE '%value%') db.collection.find({"field": /.*value.*/}) // Using $regex operator db.collection.find({"field": {$regex: "value", $options: "i"}}) Create Sample Data db.employee.insertMany([ {"EmployeeName": "John", "EmployeeSalary": 450000}, {"EmployeeName": "Carol", "EmployeeSalary": 150000}, {"EmployeeName": "James", "EmployeeSalary": 550000}, {"EmployeeName": "Jace", "EmployeeSalary": 670000}, {"EmployeeName": "Larry", "EmployeeSalary": 1000000} ]); Query with "like" ...

Read More

Find objects between two dates in MongoDB?

Nancy Den
Nancy Den
Updated on 14-Mar-2026 3K+ Views

Use the $gte (greater than or equal) and $lt (less than) operators with ISODate() to find documents between two dates in MongoDB. Create Sample Data db.order.insertMany([ {"OrderId": 1, "OrderAddress": "US", "OrderDateTime": ISODate("2019-02-19")}, {"OrderId": 2, "OrderAddress": "UK", "OrderDateTime": ISODate("2019-02-26")}, {"OrderId": 3, "OrderAddress": "IN", "OrderDateTime": ISODate("2019-03-05")} ]); Find Between Two Dates Find orders between Feb 10 and Feb 21 ? db.order.find({ "OrderDateTime": { $gte: ISODate("2019-02-10"), ...

Read More

Update MongoDB field using value of another field?

Krantik Chavan
Krantik Chavan
Updated on 14-Mar-2026 2K+ Views

In MongoDB, you can update a field using the value of another field in the same document. There are two main approaches − using the aggregation pipeline with $set (MongoDB 4.2+) or using $addFields with $out for writing results to a collection. Method 1: Update with Aggregation Pipeline (MongoDB 4.2+) Use updateMany() with an aggregation pipeline to set a field based on other fields ? // Create sample data db.studentInformation.insertOne({ "StudentFirstName": "Carol", "StudentLastName": "Taylor" }); // Update: create FullName from FirstName + LastName db.studentInformation.updateMany( ...

Read More

Retrieve only the queried element in an object array in MongoDB collection?

Krantik Chavan
Krantik Chavan
Updated on 14-Mar-2026 356 Views

To retrieve only the matching element from an object array in MongoDB, use the $elemMatch projection operator or the $ positional projection operator. Both return only the first array element that matches the query condition. Create Sample Data db.objectArray.insertMany([ { "Persons": [ {"PersonName": "Adam", "PersonSalary": 25000}, {"PersonName": "Larry", "PersonSalary": 27000} ] ...

Read More

Open Source Databases

Alex Onsman
Alex Onsman
Updated on 14-Mar-2026 1K+ Views

Open source databases have publicly available source code that anyone can view, study, or modify. They can be relational (SQL) or non-relational (NoSQL), and they significantly reduce database costs compared to proprietary solutions. Why Use Open Source Databases? Database licensing is a major software expense for companies. Open source databases offer a cost-effective alternative − free to use, with community support, and no vendor lock-in. Many also offer commercial support tiers for enterprise needs. Popular Open Source Databases Database Type Key Feature MySQL Relational (SQL) Most widely used open source DB; community ...

Read More

How to prepare a Python date object to be inserted into MongoDB?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 14-Mar-2026 2K+ Views

MongoDB stores dates in ISODate format. PyMongo (the official MongoDB driver for Python) directly supports Python's datetime.datetime objects, which are automatically converted to ISODate when inserted. There are three common ways to prepare date objects for MongoDB. Method 1: Current UTC Timestamp Use datetime.datetime.utcnow() to insert the current UTC time ? import datetime from pymongo import MongoClient client = MongoClient() db = client.test_database result = db.objects.insert_one({"last_modified": datetime.datetime.utcnow()}) print("Date Object inserted") Date Object inserted Method 2: Specific Date Use datetime.datetime(year, month, day, hour, minute) for a fixed date ? ...

Read More

Difference Between RDBMS and Hadoop

Shirjeel Yunus
Shirjeel Yunus
Updated on 14-Mar-2026 4K+ Views

RDBMS stores structured data in tables with ACID compliance using SQL. Hadoop is an open-source framework for distributed storage and processing of large-scale structured and unstructured data using HDFS and MapReduce. What is RDBMS? RDBMS (Relational Database Management System) stores data in tables with rows and columns, following ACID properties (Atomicity, Consistency, Isolation, Durability). It is designed for fast storage and retrieval of structured data using SQL. Examples: Oracle, MySQL, PostgreSQL. What is Hadoop? Hadoop is an open-source framework for running distributed applications and storing large-scale data. It handles structured, semi-structured, and unstructured data with high ...

Read More

How To Configure PostgreSQL 12 Streaming Replication in CentOS 8?

Satish Kumar
Satish Kumar
Updated on 14-Mar-2026 1K+ Views

PostgreSQL Streaming Replication continuously streams Write-Ahead Log (WAL) data from a primary (master) node to standby (slave) nodes, creating near-real-time database copies for high availability and fault tolerance. Master Read/Write WAL Slave 1 Slave 2 Read-only Read-only Master Node Configuration 1. Enable WAL Archiving Edit ...

Read More

How to Download and Install PostgreSQL on Windows?

Satish Kumar
Satish Kumar
Updated on 14-Mar-2026 1K+ Views

PostgreSQL is a powerful, open-source relational database system used for enterprise applications. This guide covers downloading, installing, configuring, and testing PostgreSQL on Windows. Downloading PostgreSQL Go to postgresql.org/download/windows Click Download the installer (EnterpriseDB graphical installer) Select the latest version for your OS (64-bit recommended) Download will begin automatically Installing PostgreSQL Run the downloaded installer and follow these steps − Step 1: Welcome screen → Click Next Step 2: Select components (keep all selected: PostgreSQL Server, pgAdmin, Command Line Tools, Stack Builder) Step 3: Choose installation directory (default recommended) Step 4: Choose data ...

Read More
Showing 1–10 of 61,284 articles
« Prev 1 2 3 4 5 6129 Next »
Advertisements