Here is BSON from one of our corrupted records https://raw.github.com/gist/ad402de2e594055d245e/a50138ca1e901a7b277bd174a976b4dacec5b52a/gistfile1.txt
Our object structure (specified only broken key):
How it should be:
{ ... 'offers': { 'last_offer': Date 'list': [ {...}, {...} ] } ... }
How it actually is in BSON above:
{ ... 'offers': { 'last_offer': Date 'list': [ {...}, {...} ], 'list': { '0':{ # can be any idx ... } } } ... }
YES, 2 same keys in one object with different values, in bson: `\x04list ... \x03list`. First is array and second is hash.
Due different driver realisations mongo console returns first version, and ruby driver returns second (hash).
I tried to run `db.collection.validate(true)` but mongo did't show errors.
Here is our usage, that can cause it:
We have 2 different scripts, both use ruby. One script makes $push to 'offers.list', and second script do $set on array member "offers.list.#
{idx}". I happens in different sessions (i'm not calling $set and $push in same update).For some reason sometimes mongo thinks that array is empty key, and when i call $set "offers.list.#{idx}
" it creates new version of this field which looks like "offers": {"list": { idx:
{...}} }, so it creates new hash instead of modifying array.
Frankly i cant really understand if its driver, bson gem, or mongo issue.