Choosing a MongoDB Shard Key: Ranged, Hashed, and Composite
Pick a MongoDB shard key that matches your query pattern, avoids write hotspots, and supports efficient range scans.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Pick a MongoDB shard key that matches your query pattern, avoids write hotspots, and supports efficient range scans.
High-frequency sensor data can bloat regular MongoDB collections. Time series collections automate bucketing, compression, and expiration—if you declare them at creation time.
MongoDB Change Streams give you a resumable, oplog‑backed event feed for real‑time architectures. This post covers core mechanics, sharded‑cluster ordering, operational limits, and a ready‑to‑run Node.js consumer that persists resume tokens for fault‑tolerant processing.
Mongoose virtuals let you define computed properties like fullName without storing them in MongoDB, but they are hidden from JSON output unless you enable schema serialization.
Design a minimal replica set with MongoDB Change Streams, handle resume tokens, and verify real‑time updates without polling.
Use Mongoose skip() and limit() with countDocuments() for stable, index-aware page-based pagination in Node.js.
See how MongoDB TTL indexes automatically delete expired session tokens, with a step‑by‑step example and notes on latency and maintenance.
Learn how to add a Mongoose pre‑save hook that hashes passwords with bcrypt only when they are changed, keeping plaintext credentials out of MongoDB.
Stop repeating data sanitization logic in your controllers. Learn how to use Mongoose pre and post hooks to centralize password hashing and side effects.