Tag: MongoDB

22 articles

MongoDB Basic Operations: Database, Collection & CRUD Guide

MongoDB common commands include show dbs to list databases, use to switch databases, db.createCollection() to create collections, show collections to list collections, db.collection.drop() to delet...

NoSQL Databases: MongoDB, Redis, HBase, Neo4j Comparison

NoSQL is a general term for non-relational databases, including document-based MongoDB, key-value Redis, column-store HBase, and graph database Neo4j, each with its own characteristics and use cases.

MongoDB BSON Format: Core Storage Format vs JSON

BSON is MongoDB's core storage format, a binary-encoded JSON-like format. Compared to JSON, BSON supports more data types like Date, Binary, ObjectId, with better performance.

MongoDB Indexing: Types, Principles & Best Practices

MongoDB indexes are core mechanisms for improving query performance, including single field indexes, compound indexes, multi-key indexes, geospatial indexes, text indexes and hashed indexes.

MongoDB Index Management & explain Execution Plan Analysis

MongoDB index management includes createIndex, getIndexes, dropIndex operations. explain analysis supports queryPlanner, executionStats, allPlansExecution modes, analyzing query performance through...

MongoDB Aggregation: $match, $group, $project, $sort Pipe...

MongoDB aggregation framework processes documents through multi-stage pipelines, implementing complex operations similar to SQL GROUP BY, JOIN, SUM, AVG. Common stages include $match, $group, $proj...

MongoDB Pagination: skip() + limit() + sort() & Performance

MongoDB implements pagination through combination of skip(), limit() and sort() methods. Performance optimization suggestions include avoiding large skip values and using range queries as alternati...

MongoDB Data Insert, Batch Write & Logical Queries AND OR...

MongoDB data operations include single insertOne() and batch insertMany(). Query operators include $eq, $ne, $gt, $lt, etc. Logical operators include $and, $or, $not.

MongoDB vs MySQL: B-Tree vs B+Tree Index Mechanisms

MongoDB uses B-tree indexes where nodes store both data and keys. MySQL uses B+tree indexes with all data concentrated in leaf nodes. B+tree is better for range queries, B-tree is better for random...

MongoDB Use Cases & Selection Guide

MongoDB is suitable for website data storage, caching systems, big data analysis, IoT, social media, live streaming platforms and more. Not suitable for scenarios requiring complex transactions and...

Spring Boot MongoDB: Template vs Repository with Index Tips

Two ways to connect Spring Boot to MongoDB: MongoTemplate and MongoRepository, with complete Java code examples and common problem troubleshooting.

Java MongoDB CRUD: Complete Guide from Setup to Operations

Complete guide to accessing MongoDB with Java, including environment setup, Maven dependencies, connection, CRUD operations, POJO mapping, index management, aggregation queries and transaction hand...

MongoDB Slow Query Analysis & Index Tuning

MongoDB slow query analysis through built-in Profiler, set db.setProfilingLevel(1, m) to record slow queries. EXPLAIN analysis helps identify performance bottlenecks and optimize queries.

MongoDB Storage Engines: WiredTiger vs InMemory Comparison

Comparison of MongoDB's two main storage engines WiredTiger and InMemory, including configuration methods and verification steps. WiredTiger recommended for production environments.

MongoDB Replica Set Containerization: Keyfile + Auth Quic...

MongoDB 7 replica set containerization best practices: generate keyfile, explicitly enable --auth, use one-time container for rs.initiate and admin user creation.

MongoDB Replica Set Deployment: Single Machine Three Inst...

MongoDB replica set single machine three instance deployment guide including configuration, initialization, adding/removing nodes, elections, read-write separation and rollback operations.

MongoDB Data Modeling: Embedded vs Reference Selection Guide

MongoDB data modeling choice between embedded and reference, following three principles: embed for 1:few, use reference for unbounded growth, use $lookup+index for cross-collection association. Wir...

MongoDB Replica Set: oplog, Heartbeat & Elections Explained

MongoDB replica set concepts: oplog location and idempotency, heartbeat frequency and election timeout, member/voting limits (50/7). Note that master-slave replication was removed since 4.0.

MongoDB Production Security Hardening: Auth, RBAC & TLS

MongoDB production environment security hardening guide including authentication, RBAC minimum privileges, internal network bindIp/firewall ACL, TLS/SSL encryption.

MongoDB Sharding: Shard, Config Server, Mongos Complete G...

MongoDB sharded cluster detailed explanation: sharding consists of Shard, Config Server, Mongos. Shard key selection includes range sharding, hashed sharding, zone sharding. Includes minimal runnab...

MongoDB Auth & Permissions: Single Instance to Sharded Cl...

MongoDB authentication and permission configuration from single instance to sharded cluster. Implementation order: create admin/root first → enable authorization → assign permissions by database.

MongoDB Sharded Cluster Deployment: Complete Guide with S...

Step-by-step MongoDB sharded cluster setup (configsvr×3 + two shard replica sets×3 nodes + multiple mongos), including configuration, initialization, adding shards, balancing and rollback.