How to retrieve document values

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.6.2
    • Component/s: libmongoc
    • None
    • Environment:
      Windows 10
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      After getting a document via mongoc_collection_find_with_opts, how can one retrieve its object values. In all the documentation and tutorial examples, the only thing seems to make a JSON representation of the document. For instance, getting a document from the restaurants collection (with a resctricting projection):

      {"borough":"Bronx","cuisine":"Bakery","grades":[{"date":{"$date":1393804800000}},...],"name":"Morris Park Bake Shop"}
      

      In particular, unlike when exporting a collection, dates are numerical and there are no examples explaining how to retrieve a human readible value.
      When accessing MongoDB from java, there are a set of functions enabling to retrieve values from a document, such as getDouble, but looking in C driver API reference, there are no functions related to bson_document. I am missing something or are they missing from the C driver API?
      If so, the interest of this driver is very limited.

            Assignee:
            Unassigned
            Reporter:
            Olivier Bertrand [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: