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

Allow custom cursor classes from command and query results

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.1.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      executeQuery() methods can return a QueryResult, provided server communication is still performed so that exceptions can be raised if necessary (we don't want to reimplement the current MongoCursor model, which can exist without having talked to a server).

      The QueryResult should implement IteratorAggregate, and allow the cursor class to be customized. Possible implementations of a cursor might be one that returns raw BSON objects, hydrated PHP classes, or associative arrays. We'll likely have a base Cursor class that can be extended (with a final, private constructor – since initialization should not be done in userland). QueryResult will need to provide some way to inject dependencies into a Cursor class (e.g. allow an init callback to be registered, so folks can call setter methods).

      Consider implementing the same for CommandResult and its cursor interaction. CommandResult should likely also implement IteratorAggregate and return an iterator of one result (the entire command document) for commands that do not support cursor results.

            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: