Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2183

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

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Client
    • Labels:
      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@mongodb.com Mathias Stearn
            Reporter:
            mediamath MediaMath Mongo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: