You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Yves HAMEL <yh...@macif.fr> on 2018/05/22 12:06:28 UTC
PutMongoRecord issue
Hi,
I have to save json data to a mongodb database. I use PutMongoRecord
processor.
My flow file has the following form :
[{"name":"aaaa", "data":[1,2,3]},{"name":"bbbb", "data":[1,2,3]}]
In my processor properties I set a JsonTreeRead service for valadating json
data.
I could validate simple data ("name":"aaa") but I can't validate array.
Here is my schema :
{
"namespace": "nifi",
"name": "test",
"type": "record",
"fields": [
{ "name": "nom", "type": "string" },
{
"name":"data", "type":{
"type":"array",
"items":"string"
}
}
]
}
What is the schema syntax for array type ?
Why is the schema validation mandatory ? Can I set PutMongoRecord processor
without that validation ?
Thanks,
Yves
(Embedded image moved to file: pic18716.jpg)
Yves HAMEL
Direction Digital & Systèmes d’Information Groupe
LM_DATA
MACIF - 2 et 4, rue Pied de Fond - 79037 Niort cedex 9
Tél. : +33 (0)5 49 09 36 06
Email : mon.email@macif.fr / Pré Doyen 2 – bureau 999
www.macif.fr - Appli présente sur Google Play Store & Apple Store
(Embedded image moved to file: pic19718.jpg)
Re: PutMongoRecord issue
Posted by Mike Thomsen <mi...@gmail.com>.
I think the ability to read a JSON array as a record set was added early in
1.7.0-SNAPSHOT, so that may be part of the problem here. You should also
set the type for the array to be int or long for the items unless you
really want string versions.
On Tue, May 22, 2018 at 8:06 AM Yves HAMEL <yh...@macif.fr> wrote:
>
> Hi,
> I have to save json data to a mongodb database. I use PutMongoRecord
> processor.
> My flow file has the following form :
> [{"name":"aaaa", "data":[1,2,3]},{"name":"bbbb", "data":[1,2,3]}]
> In my processor properties I set a JsonTreeRead service for valadating json
> data.
> I could validate simple data ("name":"aaa") but I can't validate array.
> Here is my schema :
> {
> "namespace": "nifi",
> "name": "test",
> "type": "record",
> "fields": [
> { "name": "nom", "type": "string" },
> {
> "name":"data", "type":{
> "type":"array",
> "items":"string"
> }
> }
> ]
> }
> What is the schema syntax for array type ?
> Why is the schema validation mandatory ? Can I set PutMongoRecord processor
> without that validation ?
>
> Thanks,
> Yves
> (Embedded image moved to file: pic18716.jpg)
>
> Yves HAMEL
> Direction Digital & Systèmes d’Information Groupe
> LM_DATA
>
> MACIF - 2 et 4, rue Pied de Fond
> <https://maps.google.com/?q=4,+rue+Pied+de+Fond&entry=gmail&source=g> -
> 79037 Niort cedex 9
> Tél. : +33 (0)5 49 09 36 06 <+33%205%2049%2009%2036%2006>
> Email : mon.email@macif.fr / Pré Doyen 2 – bureau 999
>
> www.macif.fr - Appli présente sur Google Play Store & Apple Store
> (Embedded image moved to file: pic19718.jpg)