[ 
https://issues.apache.org/jira/browse/NIFI-11529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pierre Villard resolved NIFI-11529.
-----------------------------------
    Resolution: Feedback Received

Apache NiFi 1.x is no longer maintained and no new release is planned on the 
1.x release line. Marking as resolved as part of a cleanup operation. Please 
open a new one with an updated description if this is still relevant for NiFi 
2.x.

> PutMongo Update with operators fails with "readStartDocument can only be 
> called when CurrentBSONType is DOCUMENT, not when CurrentBSONType is ARRAY"
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-11529
>                 URL: https://issues.apache.org/jira/browse/NIFI-11529
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.21.0
>         Environment: Official Docker
>            Reporter: Benji Benning
>            Priority: Major
>              Labels: MongoDB
>
> When trying to perform an update with an aggregation pipeline using PutMongo, 
> the update fails with the following error:
>  
> {code:java}
> 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)
> {code}
>  
> I’m setting the query as a simple field match, but the body of aggregation 
> pipelines is framed as an array ( [ … ] ), for example:
>  
> {code:java}
> [
>      {
>           “$set”: {
>                ...
>           }
>      }
> ]
> {code}
> Instead of what the standard updates object look like( \{…} ).
> Same identical queries work from other tools and using python.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to