I tried to reproduce your results from the shell, but I wasn’t successful. The script I ran for local testing is here. I was testing against a single node replicaset with server version 4.4.1. You mentioned your command works in the shell, so can you see if my script differs from the commands you ran at all? If you want to run the script I linked, you can download it, start up a cluster, and run mongo main.js.
I am looking for a solution to the same issue.How do I do this below command via Mongo Golang Driver UpdateMany Option? Both propertyA and propertyB already exist in the db, and I am trying to copy the value from propertyA to propertyB.
“numYields":0,“ok”:0,“errMsg”:“$set specification stage must be an object, got array”,“errName”:“Location40272”,“errCode”:40272,“locks”:{“ParallelBatchWriterMode”:{“acquireCount”:{“r”:1}},“FeatureCompatibilityVersion”:{“acquireCount”:{“w”:1}},“ReplicationStateTransition”:{“acquireCount”:{“w”:1}},“Global”:{“acquireCount”:{“w”:1}},“Database”:{“acquireCount”:{“w”:1}},“Collection”:{“acquireCount”:{“w”:1}},“Mutex”:{“acquireCount”:{“r”:1}}},“flowControl”:{“acquireCount”:1,“timeAcquiringMicros”:111},“readConcern”:{“level”:“local”,“provenance”:“implicitDefault”},“remote”:“172.17.0.1:59242”,“durationMillis”:0}}
Any idea what I am doing wrong? Are there examples on how we can do via golang driver.
Driver Version: go.mongodb.org/mongo-driver v1.11.4
Mongo Version (running in docker) : mongo:5.0.22