[CXX-2580] Docs: Missing Documentation for Change Streams Created: 27/Sep/22  Updated: 28/Oct/23  Resolved: 08/Mar/23

Status: Closed
Project: C++ Driver
Component/s: Docs Examples
Affects Version/s: None
Fix Version/s: 3.8.0

Type: Task Priority: Unknown
Reporter: Steve Silvester Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: buildfest-2022
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Related
is related to CXX-1450 ChangeStreams Examples for Docs Closed
Quarter: FY24Q1

 Description   

We are missing a tutorial on changestreams for C++, we used the example in the repository instead for build fest.



 Comments   
Comment by Githook User [ 08/Mar/23 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CXX-2580 fix change stream examples (#938)

  • use mongocxx::pool

Will be necessary to insert documents in a separate thread.

  • insert documents in a separate thread

use username: alice to satisfy $match stage in Example 4

  • update examples

Repeat iteration until receiving the first document.
This currently infinitely loops due to no events being generated.

  • use atomic store

fixes this error on g++7.5.0:
```
/home/ubuntu/code/mongo-cxx-driver-CXX2580/src/mongocxx/test/change_streams.cpp:448:43: error: use of deleted function 'std::atomic<bool>::atomic(const std::atomic<bool>&)'
std::atomic_bool insert_thread_done = false;
^~~~~
```

  • use string_view compare, not ==

fixes this error on g++7.5.0: `no match for 'operator=='`

  • link to thread library in test_driver
  • construct bsoncxx::document::value explicitly

Fixes VS2015 error:

C:\local\boost_1_60_0\boost/optional/optional.hpp(629): error C2664: 'void boost::optional_detail::optional_base<T>::assign_value(bsoncxx::v_noabi::document::value &&,boost::optional_detail::optional_base<T>::is_reference_tag)': cannot convert argument 1 from 'const bsoncxx::v_noabi::document::view' to 'const bsoncxx::v_noabi::document::value &' [C:\data\mci\61c6a13adf46b665b82425a7e8fac2db\mongo-cxx-driver\build\src\mongocxx\test\test_driver.vcxproj]

  • Update src/mongocxx/test/change_streams.cpp

Co-authored-by: Roberto C. Sánchez <roberto@connexer.com>
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/7d2c24e8f93c5f3d50236a9cd2faa6c8db4b703a

Generated at Wed Feb 07 22:06:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.