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

Fail Combine Multiple Nested Queries with MongoDB C+11 Driver

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: API

      error: invalid operands to binary expression ('key_context > >' and 'bsoncxx::v_noabi::builder::stream::document') open_document << conditionI << close_document << ~~~~~~~~~~~~~ ^ ~~~~~~~~~~

      using bsoncxx::builder::stream::document;
      using bsoncxx::builder::stream::open_document;
      using bsoncxx::builder::stream::close_document;
      using bsoncxx::builder::stream::open_array;
      using bsoncxx::builder::stream::close_array;
      using bsoncxx::builder::stream::finalize;
      typedef mongocxx::cursor::iterator dociter;
      typedef bsoncxx::v_noabi::document::view docview;
      mongocxx::instance inst{};
      mongocxx::client conn{mongocxx::uri{"mongodb://10.9.0.1:27017"}};
      mongocxx::collection collection = conn["crawler"]["article"];
      mongocxx::options::find opts;
      document query, conditionI, conditionII, options;
      conditionI << "publishTime" << open_document << "$gte" << timedomain << close_document;
      conditionII << "lastread" << open_document << "$gte" << readdomain << close_document;
      options << "read" << 1 << "likes" << 1 << "body.title" << 1 << "body.content" << 1;
      opts.limit(100);
      opts.sort(options.view());
      query << "$or" << open_array <<
      open_document << conditionI << close_document <<
      open_document << conditionII << close_document <<
      close_array;
      mongocxx::cursor cursor = collection.find(conditionI.view(), opts);

            Assignee:
            matt.cotter Matt Cotter
            Reporter:
            LeoZhao zy1989 [X]
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: