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

$slice operator- skipping n elements from the end of an array where n > than array length doesn't return null values

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Query
    • ALL

      Consider the document:
      {_id: 1, a : [1,2,3,4,5]}

      db.collection.find({}, {a : {$slice : [-10, 1]}}) returns
      {_id : 1, a : [1]}

      whereas
      db.collection.find({}, {a : {$slice : [10, 1]}}) returns
      {_id : 1, a : []}

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            jenna Jenna deBoisblanc
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: