UNPKG

modm

Version:

A MongoDB Object Document Mapper (ODM)

24 lines (20 loc) 521 B
// TODO define objectid options var modm = require("../index"); var ObjectID = require("mongodb").ObjectID; var Schema = new modm.Schema({ objectid: { type: ObjectID, required: true, default: new ObjectID() //validate: function () {}, //manipulate: function () {}, //live: true } }); var test1 = { objectid: new ObjectID() }; module.exports = function(model, callback) { var document = model("objectid", Schema); document.insert(test1, callback); };