bson icon indicating copy to clipboard operation
bson copied to clipboard

Order of elements not preserved

Open stedolan opened this issue 8 years ago • 0 comments

When a document is encoded and then decoded, the order of elements is reversed.

# open Bson
# let d = empty
  |> add_element "a" (create_string "a")
  |> add_element "b" (create_string "b");;
val d : Bson.t = <abstr>
# print_endline (to_simple_json d);;
{"b" : "b", "a" : "a"}
- : unit = ()
# print_endline (to_simple_json (decode (encode d)));;
{"a" : "a", "b" : "b"}

stedolan avatar May 19 '17 15:05 stedolan