Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2112

How to retrieve document values

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.6.2
    • libmongoc
    • None
    • Windows 10

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: