Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Mongodb Object Document Mapper
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
lib
.gitignore
README.md
index.js
package.json

README.md

MODM

Mongodb Object Document Mapper

Basic example

var modm = require('modm');

// define a schema
schema = modm.schema({field: String});

// create db connection
model = modm('myDb', {
    host: '127.0.0.1',
    port: 27017,
    server: {pooSize: 5},
    db: {w: 1}
});

// get collection
myCollection = model('myCollection', schema);

// db operations
myCollection.insert({data: 1}, function (err, item) {
   //... 
});

Info

Results of atomic operations are not validated.

Schema options

type: String, // Array | Boolean | Buffer | Date | Number | Object | ObjectID
required: true, // false
default: 'default' // default value
validate: function () {}, // email, url, ...
manipulate: function () {},
pre: 'pre', // "string"
post: 'post', // "string"
charStyle: 'normal', // uppercase | lowercase
trim: true, // false
maxLength: 5, // integer
minLength: 1, // integer
max: 5, // number
min: -3, // number

//coming soon...
live: true // false
Something went wrong with that request. Please try again.