Operational Defect Database

BugZero found this defect 59 days ago.

MongoDB | 2616242

Poor error message with bad $merge whenMatched Pipeline

Last update date:

3/21/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

This $merge pipeline is bad, but the user does not get an error that makes sense for it. MongoServerError[CommandFailed]: Failed to get stream processor results: could not get resources for stream processor: ObjectID("65fc502c939d9731dbf91d74"), correlationID = 17bed0bde7c19b2cc15655ec AtlasStreamProcessing> using the following db.createCollection("gps")db.createCollection("gps_array_push")db.gps_array_push.createIndex({"vehicle_id": 1}, {unique: true}) var cols = db.getCollectionNames() for (const el of cols){ db.runCommand( { collMod: "gps", changeStreamPreAndPostImages: { enabled: true } } )} db.gps.insertOne({ "vehicle_id": "vid0001", "coord": [37.76643495, -122.3969431 ], })db.gps.insertOne({ "vehicle_id": "vid0001", "coord": [38.76643495, -123.3969431 ], })db.gps.insertOne({ "vehicle_id": "vid0001", "coord": [39.76643495, -124.3969431 ], })db.gps.insertOne({ "vehicle_id": "vid0001", "coord": [40.76643495, -125.3969431 ], }) s = { $source: { connectionName: 'jsncluster0', db: 'test', coll: 'gps', config : { fullDocument: 'whenAvailable', }, }}rr = { $replaceRoot: { newRoot : "$fullDocument"} } af = {$addFields : { "gps_array" : [{"coord" : "$coord"}]}} un = {$unset : ["coord"]} m = {$merge : { into: { connectionName: "jsncluster0", db: "test", coll: "gps_array_push"}, on: ["vehicle_id"], let : {event_array : "$gps_array"}, whenMatched : [ { $push: { gps_array: "$$event_array" }}], whenNotMatched: "insert"}} sp.process([s,rr,af,un,m])

Top User Comments

JIRAUSER1272488 commented on Thu, 21 Mar 2024 15:46:26 +0000: also note, this is stuck in STARTED state, and I cannot stop/drop it even with repeated attempts. AtlasStreamProcessing> sp.bugtest.drop() MongoServerError[CommandFailed]: Failed to drop stream processor: stream processor does not appear to be running, correlationID = 17bed22193bdab4a12f0a0e7 JIRAUSER1272488 commented on Thu, 21 Mar 2024 15:43:42 +0000: I tired this with sp.createStreamProcessor and a DLQ. No messages get set to the DLQ, and sp.listProcessors provides the following error: { id: '65fc5506939d9731dbf9213b', name: 'bugtest', lastModified: ISODate('2024-03-21T15:40:54.660Z'), state: 'STARTED', errorMsg: "Error encountered in MergeOperator while writing to target db: test and collection: gps_array_push: Unrecognized pipeline stage name: '$push': generic server error",

Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Open

Learn More

Search:

...