Minimalistic ODM (Object Document Mapper) for MongoDB on Node.js. Version 3.1.18 wraps the node-mongodb-native driver with a simple model API including find, save, and remove operations. Requires Node >=0.4.12. It is a lightweight alternative to Mongoose with a focus on simplicity, error handling via callbacks, and common idioms. Designed for small projects or when a full-featured ODM is unnecessary.
npm install p-odmNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MongoDB, defines a User model with name and Birthday fields, fetches all users, creates and saves a new user.
Install with 'npm install odm' (case-insensitive) and require with 'require('odm')'.Wrap callbacks in a Promise or use an alternative ODM that supports Promises, such as Mongoose or the native MongoDB driver.
Use the native MongoDB driver directly if advanced connection options are required.
For complex schemas, consider using Mongoose or validate data manually before saving.
Ensure 'var ODM = require('odm');' is executed before calling ODM.connect().Run 'npm install odm' (not 'npm install p-odm').
Use 'User.findAll(callback)' where User is the model returned from ODM.model(), not a new User instance.