Mongoose Interacting with Data – CRUD

Model methods and instance methods

So what do we mean by model methods? Well, if we have a model called User, some of the methods provided by Mongoose are User.create, User.find, User.update, and User.remove. The method names may be slightly different, but out of the box we’ve got methods for all four CRUD (Create, Read, Update, and Delete) operations right there.
继续阅读: %s

Mongoose 入门系列- Schemas and Models


简单的说,schema 就是如何定义数据的结构。在mongoose里面,schema用JSON object作为定义。

var userSchema = new mongoose.Schema({
  name: String,
  email: String,
  createdOn: Date

继续阅读: %s

mongoose 建立数据库连接

mongooose is a mongodb object modeling for node.js

  • monggose.connect
  • createConnection
  • 继续阅读: %s