[CXX-860] Fail Combine Multiple Nested Queries with MongoDB C+11 Driver Created: 09/Mar/16 Updated: 24/Mar/16 Resolved: 11/Mar/16 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | API |
| Affects Version/s: | 3.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | zy1989 [X] | Assignee: | Matt Cotter |
| Resolution: | Done | Votes: | 0 |
| Labels: | query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
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; |
| Comments |
| Comment by Matt Cotter [ 11/Mar/16 ] | |||||||||||||||||||||||||||||||||||
|
Glad to help! If you have other feedback on the driver, please let us know! | |||||||||||||||||||||||||||||||||||
| Comment by zy1989 [X] [ 10/Mar/16 ] | |||||||||||||||||||||||||||||||||||
|
In addition, following code also work. condition << "$and" << open_array << options << "subscribeRobot" << 1 << "body.title" << 1 << "body.content" << 1; mongocxx::cursor cursor = collection.find(condition.view(), opts); | |||||||||||||||||||||||||||||||||||
| Comment by zy1989 [X] [ 10/Mar/16 ] | |||||||||||||||||||||||||||||||||||
|
Thank Matt, It works. | |||||||||||||||||||||||||||||||||||
| Comment by Matt Cotter [ 09/Mar/16 ] | |||||||||||||||||||||||||||||||||||
|
Hi LeoZhao, The issue is that you are trying to append the bsoncxx::builder::stream::document into the stream after the open document:
In order to accomplish this, you can either concatenate the document:
or you can simply append the `conditionI` document as a bson document type:
Below is an example to illustrate this:
|