stijnsanders / TMongoWire

Delphi MongoDB driver
MIT License
102 stars 37 forks source link

Corrupted BSON output when saving documents containing arrays #4

Closed smokingdev closed 12 years ago

smokingdev commented 12 years ago

Hi,

I found a bug which corrupted the BSON output of a document containing an array.

The code didn't take in account the start of the BSON document when writing the size of the array, I fixed it in the including commit and now the documents are getting saved.

Regards,

Fred Oranje

stijnsanders commented 12 years ago

are you sure lstart is the right value to add? vstart should already contain the value of lstart since it gets the ltotal value early on in the loop, which would mean you add two file-indexes, and point to somewhere too far in the file... I'll see when I can create a test environment to reproduce the problem.

stijnsanders commented 12 years ago

I was confusing code from Load and Save methods, you're right. Thank you very much.