MongoDB Document Schema

MongoDB user document with nested objects, arrays, embedded addresses, and indexed fields.

Database SchemasMongoDBNoSQLdocumentschema

MongoDB user document with nested objects, arrays, embedded addresses, and indexed fields.

Loading editor...

When to use this template

This template represents a typical MongoDB user document. It demonstrates embedding (addresses, notifications) vs. referencing (organizationId), mixed-type arrays, and timestamp fields that work with TTL indexes. Use it as a starting point for your Mongoose schema or MongoDB validation rules.