Javascript MongoError:不允许使用修饰符复制字段名

Javascript MongoError:不允许使用修饰符复制字段名,javascript,node.js,mongodb,mongoose,Javascript,Node.js,Mongodb,Mongoose,注:据我所知,我不是在做“推送”的事情 我有这个方法,第一次可以很好地工作,但是如果客户端在调用之间调用这个方法两次而没有刷新页面,我会在标题中得到错误 scenarios.findOne({'_id':partialUpdate._id},function(err,back){ if(back){ for(var p in partialUpdate){ if(partialUpdate.hasO

注:据我所知,我不是在做“推送”的事情

我有这个方法,第一次可以很好地工作,但是如果客户端在调用之间调用这个方法两次而没有刷新页面,我会在标题中得到错误

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数组,而是向它发送字符串数组,而不是像2014年4月16日星期三12:02:49 GMT-0600(山地夏时制)这样的日期。我正在向它发送
2014-04-16T18:02:49.454Z
。这有关系吗?

修复了它:

我明确地保存了
\uv
属性,这是一个禁忌


在我的循环中,我只是检查
p
是否等于
\uu v
,如果是,我将忽略它。没有问题。

从github链接:将其添加到您的架构中:
\uv:{type:Number,select:false}