MongoDB不okForForStorage错误

我已经看了很多关于这个错误的地方,似乎Mongo不会接受一个. 或更新$ ,但我仍然得到这个错误

 { [MongoError: not okForStorage] name: 'MongoError', err: 'not okForStorage', code: 12527, n: 0, connectionId: 18, ok: 1 } 

这是我正在更新的对象:

 { status: "open", type: "item", parentId: "4fa13ba2d327ca052d000003", _id: "4fa13bd6d327ca052d000012", properties: { titleInfo: [ { title: "some item" } ] } } 

我正在更新到:

 { fedoraId: 'aFedoraLib:438', status: "closed", type: "item", parentId: "4fa13ba2d327ca052d000003", _id: "4fa13bd6d327ca052d000012", properties: { titleInfo: [ { title: "some item" } ] } } 

我刚刚遇到的另一个可能的原因:存储在string键中有句点的对象。

因此,对于人们得到同样的错误:这是由于我包括_id,这是Mongo不喜欢显然

我尝试使用这个键值对(直接从AngularJS应用程序中出来)保存JSON结构时遇到了这个错误:

  "$$hashKey":"021" 

删除只是解决了这个问题。 对于其他使用Angular的人来说,它看起来像是调用Angular的内置的angular.toJson客户端来消除$$ hashkey键。 从他们的论坛:

 $scope.ngObjFixHack = function(ngObj) { var output; output = angular.toJson(ngObj); output = angular.fromJson(output); return output; }