Nodejs的MongonDB 连接包,MongooseJS 4.0.5 发布

jopen 9年前

Mongoose 是基于nodejs,使用javascript编程,连接mongodb数据库的软件包,使mongodb的文档数据模型变的优雅起来,方便对mongodb文档型数据库的连接和增删改查等常规数据操作。

mongoose是当前使用mean(mongodb express angularjs nodejs)全栈开发必用的连接数据库软件包。

// retrieve my model  var BlogPost = mongoose.model('BlogPost');     // create a blog post  var post = new BlogPost();     // create a comment  post.comments.push({ title: 'My comment' });     post.save(function (err) {    if (!err) console.log('Success!');  });     BlogPost.findById(myId, function (err, post) {    if (!err) {      post.comments[0].remove();      post.save(function (err) {        // do something      });    }  });
MongooseJS 4.0.5 发布,此版本更新内容如下:

  • fixed; ObjectIds and buffers when mongodb driver is a sibling dependency #3050 #3048 #3040 #3031 #3020 #2988 #2951

  • fixed; warn user when 'increment' is used in schema #3039

  • fixed; setDefaultsOnInsert with array in schema #3035

  • fixed; dont use default Object toString to cast to string #3030

  • added; npm badge #3020 odeke-em

  • fixed; proper handling for calling .set() with a subdoc #2782

  • fixed; dont throw cast error when using $rename on non-string path #1845

此版本现已提供下载:https://github.com/Automattic/mongoose/archive/4.0.5.zip