Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-688

Do not use mongoc_cursor_t private API in Cursor debug handler

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0-alpha1, 1.2.0
    • Affects Version/s: 1.1.6
    • Component/s: None
    • Labels:
      None

      We will move to having the following debug fields in 1.2.0:

      • database
        • Combined with "collection", this covers the old "ns" field.
      • collection
        • Combined with "database", this covers the old "ns" field. The value will be null for commands (previously, "$cmd" would have been present in the old "ns" field).
      • query
        • If the Cursor was created via executeQuery(), this will be the corresponding MongoDB\Driver\Query object. This covers the following old fields: query, fields, flags, skip, limit, batch_size.
      • command
        • If the Cursor was created via executeCommand(), this will be the corresponding MongoDB\Driver\Command object. This covers the old "is_command" field, which previously would have been false for a command cursor.
      • readPreference
        • The corresponding MongoDB\Driver\ReadPreference object passed to the execute method that created this Cursor. This will be null if the argument was unused, which means that the read preference of the underlying client (i.e. MongoDB\Driver\Manager) was used instead. The old "read_preference" field was always populated (either from the execute method argument or client).
      • isDead
        • This identical to the isDead() method. It does not directly cover the old fields: sent, done, end_of_event, in_exhaust.
      • server
        • The MongoDB\Driver\Server object corresponding to the sever on which the Cursor was executed. This replaces the old "server_id" integer field and may be more helpful for debugging.
      • currentIndex
        • This replaces the old "count" field and reports the iterator's current key. It defaults to zero.
      • currentDocument
        • This is unchanged. The value is the iterator's current element (if any). It may be null.

      The following private fields are included in the debug output for 1.1.x:

      • stamp
      • is_command
      • sent
      • done
      • end_of_event
      • in_exhaust
      • has_fields
      • query
      • fields (i.e. projection)
      • read_preference
      • flags
      • skip
      • limit
      • count
      • batch_size
      • ns
      • current_doc

      The following getters exist in libmongoc's current, public API:

      • mongoc_cursor_get_limit
      • mongoc_cursor_get_batch_size
      • mongoc_cursor_get_max_await_time_ms
      • mongoc_cursor_get_id
      • mongoc_cursor_get_hint (to include the Server)
      • mongoc_cursor_is_alive

      We should rethink the fields that we include in the Cursor's debug output. Some may be populated via phongo_execute_query() and phongo_execute_command() (e.g. namespace, Server) and others can come from the execute arguments (e.g. php_phongo_query_t, command bson_t, mongoc_read_prefs_t), which we can copy into the cursor struct.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: