stijnsanders/TMongoWire — pull request #9 by compiled (2012-05-09 07:53:19+00:00)
Title: Sorting of keys in TBSONDocument invalidated certain commands

Hi,

I was writing a map/reduce function which wouldn't function because TMongoWire was sending the 'map' key before the 'mapreduce' key. I found that the origin of this problem lies within the TBSONDocument which sorts the keys (I guess for speed reasons).

I've added a piece of code which maintains an array of the original insertion order. This array is used in the Save function to write the keys in their original order.

This solves the problem I was having and should keep the speed advantage of sorting.

Kind regards,

Fred Oranje