File: mongodb.md | Updated: 11/15/2025
š NextAuth.js is now part of Better Auth !
This is documentation for NextAuth.js v3, which is no longer actively maintained.
For up-to-date documentation, see the **latest version ** (v4).
Version: v3
On this page
MongoDB is a document database and does not use schemas in the same way as most RDBMS databases.
In MongoDB as collections and indexes are created automatically.
Objects in MongoDBā
Objects stored in MongoDB use similar datatypes to SQL, with some differences:
ID fields are of type ObjectID rather than type int.
All collection names and property names use camelCase rather than snake_case.
All timestamps are stored as ISODate() in MongoDB and all date/time values are stored in UTC.
A sparse index is used on the User email property to allow it to be optional, while still enforcing uniqueness if it is specified.
This is functionally equivalent to the ANSI SQL behaviour for a unique but nullable property.