Doing a recursive unset of _id fields in the DB exporter, as MongoDB #769

Closed
wants to merge 1 commit into from

3 participants

@coogle

doesn't let you use $set and modify _id. So if you have a document that has a sub-object and that object also has a _id field, the existing implementation breaks because it only considers the top-level _id key. This patch recursively traverses the data and removes all _id key references during an update.

@nateabele
Union of RAD member

I must not be understanding the problem correctly, because MongoDB definitely does let you update _id fields inside of sub-objects, which this patch would appear to break.

Maybe attaching a unit test (which is required for all patches anyway) would clear things up. /cc @gwoo

@coogle
@nateabele
Union of RAD member

Just did this from the console:

> db.foos.save({ bar: { _id: new ObjectId() }})
> db.foos.update({}, { $set: { bar: { _id: new ObjectId() }}})

Works fine.

Are we talking about two different things here?

@coogle
@jails
Union of RAD member

Hi @coogle, any news on this ?

@coogle
@nateabele
Union of RAD member

Closing this for now. Please re-open when we have a test or something to demonstrate the issue.

@nateabele nateabele closed this Mar 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment