Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1797

I need to be able to filter a document down to a single item in a list of items

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.6.0
    • Component/s: Querying
    • Labels:
      None
    • Environment:
      Ubuntu 10.04, 64-bit

      Consider the following document:

      db.session.save({'id': 1, 'items': [

      {'id': 1, 'name': 'foo'}

      ,

      {'id': 2, 'name': 'bar'}

      ,

      {'id': 3, 'name': 'baz'}

      ]})

      I'd like to be able to filter down to only the single

      {'id': 1, 'name': 'foo'}

      item in the 'items' list. This seems to not be possible. I can only seem to filter down to the entire 'items' list, and then in code (Python) I have to reduce the resulting list down to the 1 item I'm looking for.

      This just seems like something that should be easily done by the database. Bringing this up in the IRC channel resulted in 2 other people stating that they were actively working around the same problem.

            Assignee:
            Unassigned Unassigned
            Reporter:
            betawarz Ryan Cole
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: