mongoplayground icon indicating copy to clipboard operation
mongoplayground copied to clipboard

Not all valid pipeline expression operators listed in popup for `update`.

Open rickhg12hs opened this issue 4 years ago • 2 comments

The popups are very helpful while developing queries, but not all valid expression operators appear in the popup for the update method when using an aggregation pipeline. There may be others, but I noticed "$setIntersection" doesn't appear in the popup.

Here's a valid update method that works, but "$setIntersection" didn't appear in the popup while typing.

db.collection.update({},
[
  {
    "$set": {
      "discountItems": {
        "$setIntersection": [
          [
            "Just coffee",
            "Discount clothing"
          ],
          "$description"
        ]
      }
    }
  }
],
{
  "multi": true
})

Try it on mongoplayground.net.

rickhg12hs avatar Mar 03 '22 22:03 rickhg12hs

I based my list on operators listed here: mongodb update operator, but it looks like you can also use some of the aggregation operator in an update query ? Do you know if there are other operator missing ?

feliixx avatar Mar 04 '22 03:03 feliixx

I really don't know for sure, but I wonder if any aggregation pipeline operator is allowed inside an update aggregation pipeline.

rickhg12hs avatar Mar 04 '22 08:03 rickhg12hs