Nodejs的MongonDB 連接包,MongooseJS 4.0.5 發布
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 }); } });</pre> 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。