Ayush Kulshreshtha created CAMEL-27327:
------------------------------------------

             Summary: camel-mongodb - read InputStream and StreamCache List 
bodies as text, and accept a JSON array with surrounding whitespace
                 Key: CAMEL-27327
                 URL: https://issues.apache.org/jira/browse/CAMEL-27327
             Project: Camel
          Issue Type: Improvement
          Components: camel-mongodb
            Reporter: Ayush Kulshreshtha


Follow-up of CAMEL-27194 (https://github.com/apache/camel/pull/30514), from the 
review by Claus Ibsen.

1. The update (without the CamelMongoDbCriteria header), findOneAndUpdate and 
aggregate operations read their List body through 
MongoDbProducer.getBsonListBody, which reads a byte[] body as text since 
CAMEL-27194. An InputStream or StreamCache body, for example from 
platform-http, is not read as text, while the single-document path accepts 
InputStream and File through the existing converters. Read these bodies as text 
in the same helper.

2. MongoDbBasicConverters.isArrayNotation requires "[" and "]" at the very 
start and end, so a JSON array from a file or a Kafka record that ends in a 
newline is not seen as an array. Trim the text before the check.

3. Docs: the update section of mongodb-component.adoc describes the body only 
as a List<Bson>, and aggregate is marked "Java-only: requires Bson aggregation 
pipeline". A JSON array as text works for both now, which makes them usable 
from YAML and XML routes. Add a short note, and regenerate the catalog copy.

_Claude Code on behalf of Ayush0612005_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to