• Type: Icon: Epic Epic
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API
    • None
    • Done
    • C++ Syntactic Delights

      • More convenient C++ BSON builder syntax
      • Maybe a fast field lookup operator[]
      • Maybe cursor::foreach
      • Maybe a nicer way to iterate over bson elements. Right now, to iterate over a nested document or array, it's necessary to call get_document()/get_array():
      for (auto&& element : doc["subarray"].get_array().value) {}
      

      It should be possible to return an array or document iterator immediately, depending on the type of the element.

      for (auto&& element : doc["subarray"]) {}
      

      Ideas courtesy of ryan.timmons:

      • Maybe a bson_doc["item"].to_json() rather than to_json(bson_doc["item"]). A static method bsoncxx::document.from_json() would complement this nicely.
      • Better document best practices for usage of views/values/value_or_views, since this seems to be a common point of confusion.
      • Maybe a better way to go from a bson type to a native type, e.g. bson_val.as<int>()

            Assignee:
            Unassigned Unassigned
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: