$slice from index to end of array

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Gone away
    • Priority: Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Environment:
      All
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Would be nice to be able to get from an array all items after a given index, without knowing the length of the array. For example:

      { _id :1,
      foo: [1, 2, 3, 4, 5]
      }

      > db.test.find( {}, { foo:

      { $slice: [1, $end] }

      } )
      >

      { _id: 1, foo: [2, 3, 4, 5] }

      Currently, it seems you can only do this by:
      1. Knowing what the length is and doing this: db.test.find( {}, { foo:

      { $slice: [1, n] }

      } )
      2. Using JavaScript in the query
      3. Picking an arbitrarily high number to use as the limiter: db.test.find( {}, { foo:

      { $slice: [1, 1000] }

      } )

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Kirk Morales
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: