Tag
mongodb
Published articles tagged mongodb.
A short history of MongoDB
Document databases grew out of web-scale workloads that relational schemas struggled to keep up with. This overview situates MongoDB in the NoSQL landscape and follows the product from 10gen through WiredTiger, Atlas, transactions, and today's search and embedding features.
Authentication in MongoDB
MongoDB separates who you are from what you may do. Authentication verifies identity with SCRAM; authorization assigns roles on databases and collections. This page covers users, built-in roles, connection strings, Docker bootstrap credentials, and Atlas database users from application code.
CRUD operations in MongoDB
Documents are BSON records in collections; the Node.js driver maps them to TypeScript types. This chapter walks through insert, find, update, and delete with filters, projections, array operators, upserts, bulk writes, and the ObjectId versus string boundary at HTTP APIs.
Full-text search in MongoDB
Community deployments offer regex and text indexes; Atlas Search adds Lucene- style analyzers, fuzzy matching, and facets. This chapter compares those paths, defines Atlas Search indexes from TypeScript, runs $search locally on Atlas Local, and paginates with searchAfter.
Geospatial queries in MongoDB
Location-aware apps store coordinates as GeoJSON and query them with 2dsphere indexes. This chapter covers point and polygon shapes, near and within operators, geoNear in aggregation, legacy 2d indexes, and a store locator example in TypeScript.
Indexes and query performance in MongoDB
Indexes turn collection scans into range or point lookups. This chapter covers single and compound indexes, the ESR rule, specialty indexes, explain plans, covered queries, creating indexes from TypeScript, and capped and time series collections.
Installing and connecting to MongoDB
You can run MongoDB locally in Docker, exercise Atlas Search features with the Atlas Local image, or use a free Atlas cluster in the cloud. This runbook installs those options and connects from TypeScript with the official Node.js driver, pooling, and a clean shutdown path.
MongoDB Aggregation Framework
Aggregation runs a pipeline of stages that filter, reshape, join, and summarize documents. This chapter covers stage order, grouping and lookups, facets, window functions, writing results with merge or out, views, typed pipelines in TypeScript, memory limits, and why server-side JavaScript stages should be avoided.
MongoDB cheat sheet
A scannable reference for everyday mongosh commands, query and update operators, aggregation stages, index types, and the Node.js driver methods that implement the same operations—meant to sit beside the MongoDB series.
MongoDB glossary
Terms used across the MongoDB series—from BSON and WiredTiger through replica sets, search indexes, and embeddings—each defined briefly and linked to the chapter that goes deeper.
MongoDB with Mongoose in NestJS
@nestjs/mongoose wraps Mongoose in a dynamic module, so a connection is configured once and models are injected like any provider. This chapter connects with settings from ConfigService, defines a schema with decorators, and builds a service around an injected model.
Mongoose with MongoDB
Mongoose adds schemas, validation, middleware, and populate on top of the official driver. This focused chapter explains when an ODM helps, how to type schemas in TypeScript, and how lean queries differ from hydrated documents—without replacing the driver-first approach used elsewhere.
Pagination in MongoDB
Listing large collections page by page needs a strategy that stays fast as offsets grow and stays stable when rows are inserted or deleted. This chapter compares offset pagination with keyset cursors, total counts, and a typed paginate helper in TypeScript.
Replica sets in MongoDB
A replica set copies data across multiple mongod processes for redundancy and automatic failover. This chapter explains primary and secondary roles, elections, a local three-node Docker Compose layout, read preferences, write concern, and replica set connection strings.
Schema design in MongoDB
Flexible schemas speed up early product work but query patterns still need deliberate shape. This chapter compares embedding and referencing, common modeling patterns, anti-patterns, the 16 MB document limit, and optional JSON Schema validation at the collection level.
Transactions in MongoDB
Single-document updates are atomic; multi-document business rules need sessions and transactions on a replica set. This chapter covers withTransaction, read and write concern inside transactions, limits, and when schema design removes the need for cross-collection locks.
Vector search and embeddings in MongoDB
Semantic search stores embedding vectors next to documents and finds nearest neighbors with $vectorSearch. This chapter generates embeddings through Voyage AI, defines vector indexes on Atlas, runs hybrid queries with $rankFusion, and sketches a small RAG retrieval function in TypeScript.