You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Tristan Morris (JIRA)" <ji...@apache.org> on 2016/07/22 08:26:20 UTC

[jira] [Updated] (NIFI-2135) PutMongo replacing document instead of updating document

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

Tristan Morris updated NIFI-2135:
---------------------------------
    Attachment: nifi-mongodb-nar-0.7.0.nar
                0001-NIFI-2135-PutMongo-will-now-update-using-a-set-and-r.patch

Updates to the PutMongo processor to handle the following cases:

Insert - It'll just insert the FlowFile (JSON) as is.
Update - It'll now perform a $set with the contents of the FlowFile, and also an upsert. If the record is present then it'll be updated (attributes which are already in the database will stay), and if the record isn't present (and upsert is true) then it'll be inserted.
Replace - It'll 'overwrite' if it's in the database, or insert if upsert is true.

Apologies the tests aren't also updated.. I did brief battle as the test was being Skipped, then quickly gave up. Additional apologies as I'm sure there are problems/rule violations using the code as is. 

There are a bunch of other things to add to the PutMongo processor. So if I get the tests fixed then I'll add some more stuff.

The patch will also work with master/1.0.0.

> PutMongo replacing document instead of updating document
> --------------------------------------------------------
>
>                 Key: NIFI-2135
>                 URL: https://issues.apache.org/jira/browse/NIFI-2135
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.6.1
>            Reporter: Bryan Bende
>            Priority: Minor
>         Attachments: 0001-NIFI-2135-PutMongo-will-now-update-using-a-set-and-r.patch, nifi-mongodb-nar-0.7.0.nar
>
>
> How can I use put mongo processor to add a new key value pair to an existing document? The flow file contains the document object Id. I have set 'mode' property to 'update' and 'upsert' property to false and 'update query key' property to '_id'. Flow file content is something like this.
> {
> _id:ObjectId(577216f0154b943fe8068079)
> expired:true
> }
> Without inserting the 'expired:true', it replaces the whole document with the given one. So is there  a way to  insert the new key value pair to collection without replacing the whole collection in MongoDB using putmongo processor? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)