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

$merge with pipeline after $documents returns error

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical - P2 Critical - P2
    • None
    • 7.2.0
    • None
    • None
    • Query Optimization
    • ALL
    • Hide

      db.aggregate([
       { "$documents": [{ a: 1 }] }, 
      { "$merge": { "into": "test", "whenMatched": [{$set: {new:true}}] }}
      ])
      

      >>

      {aggregate: 1}

      is not valid for '$set'; a collection is required.

      db.aggregate([
       { "$documents": [{ a: 1 }] }, 
      { "$merge": { "into": "test", "whenMatched": [] }}
      ])
      

      >>

      {aggregate: 1}

      is not valid for an empty pipeline.

      Show
      db.aggregate([ { "$documents": [{ a: 1 }] }, { "$merge": { "into": "test", "whenMatched": [{$set: {new:true}}] }} ]) >> {aggregate: 1} is not valid for '$set'; a collection is required. db.aggregate([ { "$documents": [{ a: 1 }] }, { "$merge": { "into": "test", "whenMatched": [] }} ]) >> {aggregate: 1} is not valid for an empty pipeline.
    • QO 2024-02-05, QO 2024-02-19

    Description

      Replicates on both RS and sharded clusters in 7.2.
      Works as expected in 7.0.

      Attachments

        Activity

          People

            peter.volk@mongodb.com Peter Volk
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated: