You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This driver chooses to accept both maps and lists of key-value tuples when encoding BSON documents (1), but will only decode documents into maps. This has the side effect that document field order is lost when decoding. Maps are convenient to work with, but map keys are not ordered, unlike BSON document fields.
138
+
This driver chooses to accept both maps and lists of key-value tuples when encoding BSON documents (1), but will only
139
+
decode documents into maps. Maps are convenient to work with, but Elixir map keys are not ordered, unlike BSON document
140
+
keys.
139
141
140
-
Driver users should represent documents using a list of tuples when field order matters, for example when sorting by multiple fields:
142
+
That design decision means document key order is lost when encoding Elixir maps to BSON and, conversely, when decoding
143
+
BSON documents to Elixir maps. However, see [Preserve Document Key Order](#preserve-document-key-order) to learn how to
Additionally, the driver accepts both atoms and strings for document keys, but will only decode them into strings. Creating atoms from arbitrary input (such as database documents) is [discouraged](https://elixir-lang.org/getting-started/mix-otp/genserver.html#:~:text=However%2C%20naming%20dynamic,our%20system%20memory!) because atoms are not garbage collected.
146
+
Additionally, the driver accepts both atoms and strings for document keys, but will only decode them into strings.
147
+
Creating atoms from arbitrary input (such as database documents) is
0 commit comments