Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.21.0
-
None
-
Official Docker
Description
When trying to perform an update with an aggregation pipeline using PutMongo, the update fails with the following error:
2023-05-05 17:28:40,545 ERROR [Timer-Driven Process Thread-10] o.a.nifi.processors.mongodb.PutMongo [PutMongo[id=1a474139-9d20-1fc7-8ff1-a17c0b141b24], StandardFlowFileRecord[uuid=e6a5e4e2-e612-47e4-8963-f340b48d4c33,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1683278005774-77, container=default, section=77], offset=287952, length=887],offset=0,name=b26613be-9545-4668-aac2-d1a378f5f0f4,size=887], org.bson.BsonInvalidOperationException: readStartDocument can only be called when CurrentBSONType is DOCUMENT, not when CurrentBSONType is ARRAY.] Failed to insert {} into MongoDB due to {} org.bson.BsonInvalidOperationException: readStartDocument can only be called when CurrentBSONType is DOCUMENT, not when CurrentBSONType is ARRAY. at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:689) at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:721) at org.bson.AbstractBsonReader.readStartDocument(AbstractBsonReader.java:449) at com.mongodb.DBObjectCodec.readDocument(DBObjectCodec.java:399) at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:167) at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:67) at com.mongodb.BasicDBObject.parse(BasicDBObject.java:94) at com.mongodb.BasicDBObject.parse(BasicDBObject.java:81) at org.apache.nifi.processors.mongodb.PutMongo.onTrigger(PutMongo.java:209) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1360) at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:246) at org.apache.nifi.controller.scheduling.AbstractTimeBasedSchedulingAgent.lambda$doScheduleOnce$0(AbstractTimeBasedSchedulingAgent.java:59) at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
I’m setting the query as a simple field match, but the body of aggregation pipelines is framed as an array ( [ … ] ), for example:
[ { “$set”: { ... } } ]
Instead of what the standard updates object look like( {…} ).
Same identical queries work from other tools and using python.