- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
注意:据我所知,我不是在做推弹式的事情。
我有这个第一次工作正常,但如果客户端两次调用此方法而没有在两次调用之间刷新页面,我将在标题中得到错误。
scenarios.findOne({'_id':partialUpdate._id},function(err,back){
if(back){
for(var p in partialUpdate){
if(partialUpdate.hasOwnProperty(p)){
back[p] = partialUpdate[p];
}
}
back.save(function(err,product,numberAffected){...
刷新页面以阻止此错误发生的原因是什么?我如何知道我正在复制哪个字段名称,以便我可以停止此错误?
这是服务器输出的副本,其中包含第一组和第二组发送数据 (partialData
)、它合并的服务器数据 (back
),以及保存的数据(product
)和错误信息
第一组发送对象:
{ sortOrder: 0,
title: 'sdfsdf',
description: '',
contentType: 'false',
_id: '534ec5c98c4bf1be305fee1c',
__v: 8,
groupSharing: [],
sharingWith: [],
isPublic: false,
content: false,
attributes: [],
metrics:
[ { type: 'viewCount',
value: '1',
metric: 'Viewed',
_id: '534ec5c98c4bf1be305fee1e',
createDate: '2014-04-16T18:02:49.454Z' },
{ type: 'playCount',
value: '1',
metric: 'Played',
_id: '534ec5c98c4bf1be305fee1d',
createDate: '2014-04-16T18:02:49.453Z' } ],
bundleId: [],
video:
[ { videoLocation: 'rtmp://xxxxxxxxxxxxxxxxxxx.cloudfront.net/cfx/st/vid_51323386'
,
thumbnailLocation: 'https://xxxxxxxxxxxxxxxxxxx.cloudfront.net/thumb_51323386.
png',
_id: '534ec5c98c4bf1be305fee20',
createDate: '2014-04-16T18:02:49.457Z',
format: 'FLV' } ],
display: true,
active: true,
createDate: '2014-04-16T18:02:49.000Z',
revision: 1,
scripts:
[ { _id: '534ec5c98c4bf1be305fee1f',
display: true,
active: true,
createDate: '2014-04-16T18:02:49.454Z',
keyPoints: [],
body: [Object],
subject: [] } ],
presentation:
[ { pageLocation: null,
_id: '534ec5c98c4bf1be305fee21',
display: true,
active: true,
syncManifest: [],
pageNumber: [Object] } ],
subcategoryId: [ '53236dff2ab8b9182716f34d' ],
categoryId: [ '532369bb2ab8b9182716f33d' ],
authorId: [ '532c9a146ce0682319cebbf9' ] }
它应该覆盖的服务器上的对象:
{ sortOrder: 0,
title: 'sdfsdf',
description: '',
contentType: 'false',
_id: 534ec5c98c4bf1be305fee1c,
__v: 8,
groupSharing: [],
sharingWith: [],
isPublic: false,
content: false,
attributes: [],
metrics:
[ { type: 'viewCount',
value: '1',
metric: 'Viewed',
_id: 534ec5c98c4bf1be305fee1e,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time) },
{ type: 'playCount',
value: '1',
metric: 'Played',
_id: 534ec5c98c4bf1be305fee1d,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time) }
],
bundleId: [],
video:
[ { videoLocation: 'rtmp://xxxxxxxxxxxxxxxxxxx.cloudfront.net/cfx/st/vid_51323386'
,
thumbnailLocation: 'https://xxxxxxxxxxxxxxxxxxxxcloudfront.net/thumb_51323386.
png',
_id: 534ec5c98c4bf1be305fee20,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
format: 'FLV' } ],
display: true,
active: true,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
revision: 1,
scripts:
[ { _id: 534ec5c98c4bf1be305fee1f,
display: true,
active: true,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
keyPoints: [],
body: [Object],
subject: [] } ],
presentation:
[ { pageLocation: null,
_id: 534ec5c98c4bf1be305fee21,
display: true,
active: true,
syncManifest: [],
pageNumber: [Object] } ],
subcategoryId: [ 53236d392ab8b9182716f341 ],
categoryId: [ 532368bc2ab8b9182716f339 ],
authorId: [ 532c9a146ce0682319cebbf9 ] }
结果对象:
{ sortOrder: 0,
title: 'sdfsdf',
description: '',
contentType: 'false',
_id: 534ec5c98c4bf1be305fee1c,
__v: 9,
groupSharing: [],
sharingWith: [],
isPublic: false,
content: false,
attributes: [],
metrics:
[ { type: 'viewCount',
value: '1',
metric: 'Viewed',
_id: 534ec5c98c4bf1be305fee1e,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time) },
{ type: 'playCount',
value: '1',
metric: 'Played',
_id: 534ec5c98c4bf1be305fee1d,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time) }
],
bundleId: [],
video:
[ { videoLocation: 'rtmp://xxxxxxxxxxxxxxxxxxx.cloudfront.net/cfx/st/vid_51323386'
,
thumbnailLocation: 'https://xxxxxxxxxxxxxxxxxxx.cloudfront.net/thumb_51323386.
png',
_id: 534ec5c98c4bf1be305fee20,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
format: 'FLV' } ],
display: true,
active: true,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
revision: 1,
scripts:
[ { _id: 534ec5c98c4bf1be305fee1f,
display: true,
active: true,
createDate: Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight Time),
keyPoints: [],
body: [Object],
subject: [] } ],
presentation:
[ { pageLocation: null,
_id: 534ec5c98c4bf1be305fee21,
display: true,
active: true,
syncManifest: [],
pageNumber: [Object] } ],
subcategoryId: [ 53236dff2ab8b9182716f34d ],
categoryId: [ 532369bb2ab8b9182716f33d ],
authorId: [ 532c9a146ce0682319cebbf9 ] }
我注意到的一个区别是,我没有向它发送一个 ObjectID 数组,而是向它发送一个字符串数组,而不是像 Wed Apr 16 2014 12:02:49 GMT-0600 (Mountain Daylight时间)
我发送它 2014-04-16T18:02:49.454Z
。那有关系吗?
最佳答案
修复它:
https://github.com/LearnBoost/mongoose/issues/1933
我明确地保存了 __v
属性,这是一个禁忌。
在我的循环中,我只是检查 p
是否等于 __v
,如果是,我将忽略它。没问题了。
关于javascript - 蒙哥错误: Field name duplication not allowed with modifiers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23119823/
如何选择字段为数字的mongodb文档? 该字段内容的一些示例:“2”、“a”、“Z”、3 最佳答案 您可以使用 $type运算符根据字段的 BSON 类型进行选择,这应该可以得到你想要的。 例如,要
关注 this question @NeilLunn 已经优雅地回答了,这是我更详细的问题。 这是一组文档,有些有 user_id 有些没有。 user_id 代表创建文档的用户: { "user_i
当我发出以下查询时: db.users.find({"pic.status" : {$ne : null} }, {"pic" : 1}).toArray() 我希望收到所有 pic.status 不
我有一个包含这样记录的集合: { "_id" : ObjectId("50ae3bdb50b3d6f01400027a"), "admins": [ObjectId("5
假设您有一个文档 ID 数组存储在其他地方(例如,在 Redis 排序集中)。 使用 { _id: { $in: ids }} 查询 Mongo 文档最有效的方法是什么?并以与 ids 中相同的顺序对
如何在 MongoDB 中查找缺少某个字段的集合中的文档? 最佳答案 是的,可以使用 $exists : db.things.find( { a : { $exists : false } } );
我已经开始学习Mongo了。给定以下集合,例如所谓的帖子,我将如何将新评论插入到现有文档中?我在 mongo 网站上看到的示例是针对“简单”集合的。感谢您的帮助。 { "_id" : ObjectId
例如我们有收藏 {field: {subfield: 'name'}} {field: {subfield: 'phone'}} 我可以找到没有点符号的文档吗?像这样 db.test.find({fi
是否可以在 Mongo 查询中使用“exists”之类的内容来根据 ID 返回此记录? 类似于 select where 'ids' contains key '123456'? {
我在 Mongo 中有一组文档。说: [ { summary:"This is good" }, { summary:"This is bad" }, { summary:"S
我有超过 100 个字段,我正在寻找一种方法,以便我可以将整个集合导出为 CSV 格式 命令行要求通过提供所有字段 -f [ --fields ] arg comma seperated list o
我一直在尝试从另一台机器访问我的 mongo 实例,但出现此错误。我找不到很多对这个 whatsmyuri 错误的引用。这是我从外部机器得到的: $ mongo :27017/youtube_adve
我是一名优秀的程序员,十分优秀!