Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-757

document{} << const char* casts argument to bool

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0-rc0
    • Affects Version/s: 0.2.0
    • Component/s: BSON
    • Labels:
      None

      When constructing a query in the C++ driver, the following:

      const char *term = "value";
      document{} << "attribute" << term;

      casts the second argument (term) to bool, creating a query "attribute"=true instead of the expected "attribute" = "value". The example assumes that the attached JSON file has been loaded to collection testCollection in database test.

        1. test.json
          0.0 kB
          Scott Deerwester
        2. testConnection.cpp
          1 kB
          Scott Deerwester

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            sdeerwester Scott Deerwester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: