Skip to content

DDP mishandles non-JSON objects: Mongo ObjectIds, Dates, etc #61

@antoviaque

Description

@antoviaque

Calls to update() on pre-existing mongodb records which use ObjectId() for their _id are ignored. _Mongo.prototype.update passes the string representation of the ObjectId() to collection.update().

As a result, update() doesn't match any record. This doesn't raise any error - the update is silently ignored by the server, and the change reverted on the client.

Not sure what should be changed, but at the minimum it would be nice to be able to debug this more easily.

In my case, I've converted the _ids in my database to strings:

db.applications_hackers.find({}).forEach(function(app){
    db.applications_hackers.remove({_id:app._id}); 
    app._id = app._id.toString(); 
    db.applications_hackers.insert(app); 
});

Metadata

Metadata

Assignees

Labels

confirmedWe want to fix or implement it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions