We will move to having the following debug fields in 1.2.0:
- Combined with "collection", this covers the old "ns" field.
- 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).
- 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.
- 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.
- 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).
- This identical to the isDead() method. It does not directly cover the old fields: sent, done, end_of_event, in_exhaust.
- 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.
- This replaces the old "count" field and reports the iterator's current key. It defaults to zero.
- 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:
- fields (i.e. projection)
The following getters exist in libmongoc's current, public API:
- mongoc_cursor_get_hint (to include the Server)
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.