Using C++ and BSON, how do I serialize a key/value style container like map or unordered_map

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Client
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      There are overloaded << operators for serializing an std::vector and std::list into a BSONObjBuilder but none for containers that have key value pairs.

      I understand that all mongo arrays are really key/value pairs that simply default to "0", "1", "2", etc for the keys if you treat them as simple arrays.

      Could you provide an example of how I might serialize an STL map into a BSONObjBuilder?

            Assignee:
            Mathias Stearn
            Reporter:
            MediaMath Mongo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: