Fork me on GitHub

[

Mongoose ](https://github.com/Automattic/mongoose)

Elegant MongoDB object modeling for Node.js

  • Version 5.0.15
  • 中文文档 GitHub

Let's face it, writing MongoDB validation, casting and business logic boilerplate is a drag. That's why we wrote Mongoose.

  1. const mongoose = require('mongoose');
  2. mongoose.connect('mongodb://localhost/test');
  3. const Cat = mongoose.model('Cat', { name: String });
  4. const kitty = new Cat({ name: 'Zildjian' });
  5. kitty.save().then(() => console.log('meow'));

Mongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

Getting Started

Support

News

Changelog

Licensed under MIT. Copyright 2011 LearnBoost.