mongoose
热恋之星
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
mongoose 全量更新
mongoose文档Note:All top level keys which are not atomic operation names are treated as set operations:Example:var query = { name: 'borne' };Model.update(query, { name: 'jason bourne' }, op...原创 2018-05-25 10:47:16 · 1868 阅读 · 0 评论 -
mongoose复杂类型doc.save()无法更新的问题
原始document:{ "_id" : ObjectId("5c234903be557205da9343d7"), "apps" : {}, "createTime" : NumberLong(1545816310609), "updateTime" : NumberLong(1545816310609)}apps为复杂类型,当进行更新时const us...原创 2018-12-26 17:59:25 · 1220 阅读 · 0 评论 -
mongoose document 判断属性是否存在的问题
mongoose schema 如下const userSchema = new Schema({ username: String, password: String, age: Number, isLogin: Boolean,});我们插入一条记录const user = new User({ username: 'pandora', passwor...原创 2019-04-03 15:43:24 · 1140 阅读 · 0 评论 -
判断一个值是否是ObjectId类型
经常用到,这里记一下const mongoose = require('mongoose');const { ObjectId } = mongoose.Types;ObjectId.isValid(undefined); // falseObjectId.isValid('helloworld'); // falseObjectId.isValid('5cb44fbedba9b15b7...原创 2019-09-10 12:05:10 · 2270 阅读 · 0 评论
分享