Every collection so far has been a heap of documents with B+ tree indexes. MongoDB 1,815 also ships shapes that trade generality for a job — a capped collection is a fixed-size ring buffer, a time series collection packs measurements into hidden buckets, a GridFS bucket is a pair of collections a driver drives as a file store, and a TTL index turns a date field into a deletion schedule. The rest of the section ranks documents rather than matching values, from $text on a text index, which every Community server runs, to MongoDB Search and MongoDB Vector Search, which need Atlas 1,815 , Enterprise Advanced or a local Atlas CLI 1,815 deployment. The stages that fuse their results run anywhere on server 8.0 and later.
import { MongoClient, GridFSBucket } from 'mongodb';
import { createReadStream } from 'node:fs';
import { pipeline } from 'node:stream/promises';
const db = (await MongoClient.connect('mongodb://127.0.0.1:27017')).db('bookshelf');
const bucket = new GridFSBucket(db, { bucketName: 'media' });
await pipeline(createReadStream('manual.pdf'),
bucket.openUploadStream('manual.pdf', { metadata: { bookId: 42 } }));
const [f] = await bucket.find({ filename: 'manual.pdf' }).toArray();
console.log(f.length, 'bytes in', await db.collection('media.chunks')
.countDocuments({ files_id: f._id }), 'chunks of', f.chunkSize, '->',
(await db.listCollections().toArray()).map(c => c.name).join(' + '));716800 bytes in 3 chunks of 261120 -> media.files + media.chunks
The default chunkSize is 255 KiB, so 716,800 bytes become two full chunks and a 194,560-byte remainder. Nothing here is a server feature: media.files and media.chunks, laid out as in GridFS, are collections you query and back up like any other, and openDownloadStream(id, { start, end }) seeks straight to the chunk holding a byte range. Output below comes from a MongoDB 8.3.11 Community server; Atlas-only features show syntax only.