Mongocxx: unable to see the operationType from change stream Data

Hello everyone,

I try to implement the change stream from MongoDB on my microservice. I intend to get a notification of every change in my collection on MongoDB, I read the documentation and find a simple way to do it. However, I can not get anything from the event of the change stream. The compile phase is passed and no error. Do you have any better way to do this with CPP? or did I do something wrong? Any help or suggestion, it’s an honor and pleasure for me. Thanks and Regards

while(true/*std::chrono::system_clock::now() < end*/)
                        mongocxx::options::change_stream options;
                        const std::chrono::milliseconds await_time{1000};
                        mongocxx::change_stream streamChanges =;

                        for (const auto& event : streamChanges)
                                bsoncxx::document::view view = event;
                                bsoncxx::document::element element = view["operationType"];
                                bsoncxx::types::b_utf8 utf = element.get_utf8();
                                std::string operationType =;
                                ilog_printf(6, "op type: %s", operationType);
                                ilog_printf(6, "test changestream1");
                                std::cout << bsoncxx::to_json(event) << std::endl;
                                ilog_printf(6, "test changestream2");
                                //if (std::chrono::system_clock::now() >= end)
                                //      break;
                catch (const std::exception& e)
                        std::cerr << "MongoDB watcher caught exception: " << e.what() << std::endl;