You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by fabe_bdx <fm...@gertrude.fr> on 2018/01/09 15:00:09 UTC

PutMongo 1.3.0 - Upsert issue

Hi All,

We actually used nifi 1.3.0, with a PutMongo 1.3.0 processor, we have an
issue with the upsert capabilities of this processor. 

During the Upsert if an attribute of the document is not present in the
request from putmongo, the processor suppress it the mongo document
collection.

We don"t find any solution to this problem for 1.3.0 version, but that seem
to be resolved in the 1.5.0.

Is it possible to apply a patch to 1.3.0 version to solve this problem ?

Many thanks for your help.

Fabien.



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: PutMongo 1.3.0 - Upsert issue

Posted by Sivaprasanna <si...@gmail.com>.
It need be _id. In case of it being generated automatically, it will be
tough to keep track. It can be any valid MongoDB filter query, if I’m
right. So the query should be:
{
    <FILTER>,
    “$set” : {
        “FieldA” : “New FieldA value”
    }
}


On Fri, 16 Mar 2018 at 5:07 PM, Mike Thomsen <mi...@gmail.com> wrote:

> I noticed that your update document didn't have an update key in it. The
> default lookup key is _id so you'd need something like this:
> {
>     "_id": "ID_HERE",
>     "$set": {
>         "new_field": 1
>     }
> }
>
> On Wed, Jan 10, 2018 at 6:05 AM, fabe_bdx <fm...@gertrude.fr> wrote:
>
> > Dear Pierre,
> >
> > First all many thnaks for your help, we were able to use the copy you
> > provided us and restart Nifi with 1.5.0 module.
> >
> > But it's appear that don't realy work like expected.
> >
> > If we try to update some attributes with the $set commant it don't work.
> >
> > *Original MongoDb record :*
> >
> > {
> >     "_id" : ObjectId("5a535bcea33116f026ef65f0"),
> >     "type" : "Cc",
> >     "nmess" : 3172,
> >     "idgtr" : "C-00000-0000-00061-0000-00000-CMF-RMF",
> >     "zone" : 1.0,
> >     "idzone" : "NULL",
> >     "cmf" : 24,
> >     "rmf" : 24,
> >     "carrefour" : 61,
> >     "idcarrefour" : 2,
> >     "last_update" : "2018-01-09T13:49:58",
> >     "libelle" : " Henrique#Cebolas    ",
> >     "geojson" :
> > "{\"features\":[{\"geometry\":{\"coordinates\":[\"-9.
> > 132289080874671\",\"38.70801111111111\"],\"type\":\"
> > Point\"},\"type\":\"Feature\"}],\"type\":\"FeatureCollection\"}",
> >     "positionOk" : true,
> >     "orientation" : 0
> > }
> >
> > *Update request throw putmongo processor :*
> >
> > {
> > "$set": {
> > "type":"Cc",
> > "nmess":14488,
> > "idgtr":"C-00000-0000-00088-0000-00000-CMF-RMF",
> > "last_update":"2018-01-10T09:32:35",
> > "libelle":"Bonifacio_Estefan. "
> > }
> > }
> >
> >
> >
> >
> > --
> > Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
> >
>

Re: PutMongo 1.3.0 - Upsert issue

Posted by Mike Thomsen <mi...@gmail.com>.
I noticed that your update document didn't have an update key in it. The
default lookup key is _id so you'd need something like this:
{
    "_id": "ID_HERE",
    "$set": {
        "new_field": 1
    }
}

On Wed, Jan 10, 2018 at 6:05 AM, fabe_bdx <fm...@gertrude.fr> wrote:

> Dear Pierre,
>
> First all many thnaks for your help, we were able to use the copy you
> provided us and restart Nifi with 1.5.0 module.
>
> But it's appear that don't realy work like expected.
>
> If we try to update some attributes with the $set commant it don't work.
>
> *Original MongoDb record :*
>
> {
>     "_id" : ObjectId("5a535bcea33116f026ef65f0"),
>     "type" : "Cc",
>     "nmess" : 3172,
>     "idgtr" : "C-00000-0000-00061-0000-00000-CMF-RMF",
>     "zone" : 1.0,
>     "idzone" : "NULL",
>     "cmf" : 24,
>     "rmf" : 24,
>     "carrefour" : 61,
>     "idcarrefour" : 2,
>     "last_update" : "2018-01-09T13:49:58",
>     "libelle" : " Henrique#Cebolas    ",
>     "geojson" :
> "{\"features\":[{\"geometry\":{\"coordinates\":[\"-9.
> 132289080874671\",\"38.70801111111111\"],\"type\":\"
> Point\"},\"type\":\"Feature\"}],\"type\":\"FeatureCollection\"}",
>     "positionOk" : true,
>     "orientation" : 0
> }
>
> *Update request throw putmongo processor :*
>
> {
> "$set": {
> "type":"Cc",
> "nmess":14488,
> "idgtr":"C-00000-0000-00088-0000-00000-CMF-RMF",
> "last_update":"2018-01-10T09:32:35",
> "libelle":"Bonifacio_Estefan. "
> }
> }
>
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
>

Re: PutMongo 1.3.0 - Upsert issue

Posted by fabe_bdx <fm...@gertrude.fr>.
Dear Pierre,

First all many thnaks for your help, we were able to use the copy you
provided us and restart Nifi with 1.5.0 module.

But it's appear that don't realy work like expected.

If we try to update some attributes with the $set commant it don't work.

*Original MongoDb record :*

{
    "_id" : ObjectId("5a535bcea33116f026ef65f0"),
    "type" : "Cc",
    "nmess" : 3172,
    "idgtr" : "C-00000-0000-00061-0000-00000-CMF-RMF",
    "zone" : 1.0,
    "idzone" : "NULL",
    "cmf" : 24,
    "rmf" : 24,
    "carrefour" : 61,
    "idcarrefour" : 2,
    "last_update" : "2018-01-09T13:49:58",
    "libelle" : " Henrique#Cebolas    ",
    "geojson" :
"{\"features\":[{\"geometry\":{\"coordinates\":[\"-9.132289080874671\",\"38.70801111111111\"],\"type\":\"Point\"},\"type\":\"Feature\"}],\"type\":\"FeatureCollection\"}",
    "positionOk" : true,
    "orientation" : 0
}

*Update request throw putmongo processor :*

{ 
"$set": {
"type":"Cc",
"nmess":14488,
"idgtr":"C-00000-0000-00088-0000-00000-CMF-RMF",
"last_update":"2018-01-10T09:32:35",
"libelle":"Bonifacio_Estefan. " 
}
}




--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: PutMongo 1.3.0 - Upsert issue

Posted by Pierre Villard <pi...@gmail.com>.
Yes, if you have a running 1.5.0-SNAPSHOT NiFi running, then you could get
the NAR from the lib directory and just drop it into the directory in your
1.3 instance. Note that it's not recommended to put custom NARs into the
lib directory. Best is to define an external directory for custom NARs in
nifi.properties and drop your files in there. Note that you'll need to
restart NiFi.

If you don't have a NiFi 1.5.0-SNAPSHOT running, then you could use the
current release candidate, and follow the below process:

# Pull down nifi-1.5.0 source release:
https://dist.apache.org/repos/dist/dev/nifi/nifi-1.5.0/nifi-
1.5.0-source-release.zip

# Unzip nifi-1.5.0-source-release.zip

# Build the sources
cd nifi-1.5.0
mvn clean install -DskipTests

Pierre


2018-01-09 17:24 GMT+01:00 fabe_bdx <fm...@gertrude.fr>:

> Thanks for the repply, but i don't have any knowledge to complile NAR
> object
> :/
>
> is it possible to extract them of 1.5.0 and push it into nifi 1.3.0
> directly
> ?
>
> Thx,
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
>

Re: PutMongo 1.3.0 - Upsert issue

Posted by fabe_bdx <fm...@gertrude.fr>.
Thanks for the repply, but i don't have any knowledge to complile NAR object
:/

is it possible to extract them of 1.5.0 and push it into nifi 1.3.0 directly
?

Thx,



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Re: PutMongo 1.3.0 - Upsert issue

Posted by Pierre Villard <pi...@gmail.com>.
Hi,

Easiest solution is probably to build the Mongo NAR with 1.5.0 code, and
drop it into your NiFi 1.3. This way you'll have the two versions of the
processor available in NiFi and you can easily switch from one version of
the processor to another.

https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#component-versioning

Thanks
Pierre

2018-01-09 16:00 GMT+01:00 fabe_bdx <fm...@gertrude.fr>:

> Hi All,
>
> We actually used nifi 1.3.0, with a PutMongo 1.3.0 processor, we have an
> issue with the upsert capabilities of this processor.
>
> During the Upsert if an attribute of the document is not present in the
> request from putmongo, the processor suppress it the mongo document
> collection.
>
> We don"t find any solution to this problem for 1.3.0 version, but that seem
> to be resolved in the 1.5.0.
>
> Is it possible to apply a patch to 1.3.0 version to solve this problem ?
>
> Many thanks for your help.
>
> Fabien.
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
>