Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-203

Add MongoOperations method that returns an Iterable<T> of converted domain objects as a result from a query

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.0 M3
    • Fix Version/s: None
    • Component/s: Mapping
    • Labels:
      None

      Description

      This will let one operate on the entities that were mapped from DBObject as they stream out of the DBCursor for processing a query result set.

        Activity

        mark.pollack Mark Pollack created issue -
        aqualset Adam Qualset made changes -
        Field Original Value New Value
        Project Import Thu Oct 20 20:04:54 PDT 2011 [ 1319166294587 ]
        thomas.risberg Thomas Risberg made changes -
        Fix Version/s 1.1 M1 [ 12638 ]
        Fix Version/s 1.1 Backlog [ 12837 ]
        olivergierke Oliver Gierke made changes -
        Fix Version/s Backlog [ 12836 ]
        Fix Version/s 1.1 Backlog [ 12837 ]
        Hide
        avalynchel Nicolas Ivering added a comment -

        I'm interested in implementing this. I see a few possible approaches:

        1. Add iterateXXX methods for each findXXX method. The iterateXXX methods would return an Iterator instead of a list. The iterator would load from DBCursor and deserialize object on every call to next(). Possibly you could instead return a class with implements both Iterator and Closeable, allowing the DBCursor to be closed.
        2. Replace the return type List<T> of the findXXX methods with DataResult<T>. Interface DataResult would extend Iterator, Closeable and have a method asList() that would essentially do what the find method did originally, that is load the whole result into an ArrayList and return it. With this approach you don't have to add additional methods but it would break backwards compability.

        What do you think?

        Show
        avalynchel Nicolas Ivering added a comment - I'm interested in implementing this. I see a few possible approaches: 1. Add iterateXXX methods for each findXXX method. The iterateXXX methods would return an Iterator instead of a list. The iterator would load from DBCursor and deserialize object on every call to next(). Possibly you could instead return a class with implements both Iterator and Closeable, allowing the DBCursor to be closed. 2. Replace the return type List<T> of the findXXX methods with DataResult<T>. Interface DataResult would extend Iterator, Closeable and have a method asList() that would essentially do what the find method did originally, that is load the whole result into an ArrayList and return it. With this approach you don't have to add additional methods but it would break backwards compability. What do you think?
        tmarshall Trevor Marshall made changes -
        Workflow SPR Workflow [ 50150 ] SPR Workflow - notify Spring Data HipChat [ 82234 ]
        tmarshall Trevor Marshall made changes -
        Workflow SPR Workflow - notify Spring Data HipChat [ 82234 ] DATA Workflow [ 96687 ]
        Hide
        walery Walery Strauch added a comment -

        I believe this ticket is solved with this commit:

        https://github.com/spring-projects/spring-data-mongodb/commit/d4f1ef8704ac8907dce91ad0c14d194027a3487e

        MongoOperation.stream(Query, Class<T>) does what is described in this issue.

        Show
        walery Walery Strauch added a comment - I believe this ticket is solved with this commit: https://github.com/spring-projects/spring-data-mongodb/commit/d4f1ef8704ac8907dce91ad0c14d194027a3487e MongoOperation.stream(Query, Class<T>) does what is described in this issue.
        Hide
        mp911de Mark Paluch added a comment -

        That's fixed with DATAMONGO-1165.

        Show
        mp911de Mark Paluch added a comment - That's fixed with DATAMONGO-1165 .
        mp911de Mark Paluch made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s Backlog [ 12836 ]
        Assignee Thomas Risberg [ thomas.risberg ] Mark Paluch [ mp911de ]
        Resolution Complete [ 8 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1815d 20h 55m 1 Mark Paluch 08/Jul/16 8:50 AM

          People

          • Assignee:
            mp911de Mark Paluch
            Reporter:
            mark.pollack Mark Pollack
            Last updater:
            Mark Paluch
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: