[ https://issues.apache.org/jira/browse/NIFI-5288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16507193#comment-16507193 ]
ASF GitHub Bot commented on NIFI-5288: -------------------------------------- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2778#discussion_r194241320 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java --- @@ -154,4 +154,28 @@ public void onTrigger(final ProcessContext context, final ProcessSession session } session.commit(); } + + private Document convertArrays(Document doc) { + Document retVal = new Document(); + for (Map.Entry<String, Object> entry : doc.entrySet()) { + if (entry.getValue() != null && entry.getValue().getClass().isArray()) { + List items = new ArrayList(); + Object[] values = (Object[])entry.getValue(); + for (int index = 0; index < values.length; index++) { --- End diff -- I haven't tried this yet, but does this handle arrays of arrays? If not, should it? > PutMongoDB cannot handle arrays > ------------------------------- > > Key: NIFI-5288 > URL: https://issues.apache.org/jira/browse/NIFI-5288 > Project: Apache NiFi > Issue Type: Bug > Affects Versions: 1.6.0 > Reporter: Mike Thomsen > Assignee: Mike Thomsen > Priority: Major > > From the mailing list: > > My json document is \{"nom":"HAMEL","prenom":"YVES","tab":["aa","bb"]} > My mecord reader use the schema (generated by InferAvroSchema): > { > "type" : "record", > "name" : "Test", > "fields" : [ { > "name" : "nom", > "type" : "string", > "doc" : "Type inferred from '\"HAMEL\"'" > }, { > "name" : "prenom", > "type" : "string", > "doc" : "Type inferred from '\"YVES\"'" > }, { > "name" : "tab", > "type" : { > "type" : "array", > "items" : "string" > }, > "doc" : "Type inferred from '[\"aa\",\"bb\"]'" > } ] > } > > I did a little debug and I think I get this exeception because > PuMongoRecord maps json array to java array. But the mongodb java drivers > doesn't support java array but only support List. -- This message was sent by Atlassian JIRA (v7.6.3#76005)