instock:{$slice:1} doesn't trigger the "inclusion"

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Works as Designed
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Query Execution 2021-05-31
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/

       

      db.inventory.find({"item":"postcard"}, {_id:0, instock:{$slice:1}})
      

      returned

      { "item" : "postcard", "status" : "A", "size" : { "h" : 10, "w" : 15.25, "uom" : "cm" }, "instock" : [ { "warehouse" : "B", "qty" : 15 } ] }
      

      it was expected to return

      {"instock" : [ { "warehouse" : "B", "qty" : 15 } ] }

              Assignee:
              Irina Yatsenko (Inactive)
              Reporter:
              kuku super
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: