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

Consider addition of empty() to mongocxx::bulk_write

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • Bulk API

    Description

      The mongocxx::bulk_write class is at present write-only; one can only append() to it.

      Execution of an empty bulk_write is illegal and will result in an exception.

      It would be convenient if this class were to expose a bool empty() const function, or, alternately, an explicit boolean conversion operator, by which to determine that it's valid or invalid for execution.

      Commonly, when dealing with bulk writes, one is attempting to collate writes for performance, and execution of collated writes by a background thread is a reasonable implementation choice. In that our purported background thread presumably has no direct knowledge of the origin of the bulk_write operations it's being handed, addition of this support to bulk_write would simplify such implementations in that the thread could validate the bulk_write prior to calling execute().

      Absent this support, one tends to build up a lot of scaffolding to avoid empty bulk_write operations in a generic context such as the one described.

      Attachments

        Activity

          People

            Unassigned Unassigned
            alb@neptunesystems.com Allan Bazinet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: