[ 
https://issues.apache.org/jira/browse/CAMEL-9836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261943#comment-15261943
 ] 

ASF GitHub Bot commented on CAMEL-9836:
---------------------------------------

GitHub user jlpedrosa opened a pull request:

    https://github.com/apache/camel/pull/967

    Add the _id of the file just persisted to the context

    Hi,
    
    this PR relates to: https://issues.apache.org/jira/browse/CAMEL-9836

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jlpedrosa/camel master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/967.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #967
    
----
commit 999495ac9aae0abaa82892bf147a8be406960f8f
Author: Joseluis Pedrosa <joseluis.pedr...@elephanttalk.com>
Date:   2016-04-28T10:41:45Z

    Add the _id of the file just persisted to the context

----


> Add file id of the gridfs file created in the header of the exchange
> --------------------------------------------------------------------
>
>                 Key: CAMEL-9836
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9836
>             Project: Camel
>          Issue Type: Wish
>          Components: camel-mongodb
>    Affects Versions: 2.17.0
>         Environment: Any
>            Reporter: Jose Luis Pedrosa
>            Priority: Minor
>             Fix For: 2.17.2, 2.18.0
>
>
> Currently the camel-mongodb-gridfs component (which is not available in this 
> Jira) when a file is cretated does not return back the Id (_id) of the file 
> created, it only returns  the filename
> {code}
> String metaData = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_METADATA, 
> String.class);
>             DBObject dbObject = (DBObject) JSON.parse(metaData);
>             gfsFile.setMetaData(dbObject);
>             gfsFile.save();
>             exchange.getIn().setHeader(Exchange.FILE_NAME_PRODUCED, 
> gfsFile.getFilename());
> {code}
> mongodb api has the method getid: 
> http://api.mongodb.org/java/current/com/mongodb/gridfs/GridFSFile.html#getId--
> So i'd like to ask to:
> a) create a header field (maybe GridFsEndpoint.GRIDFS_FILE_ID_PRODUCED)
> b) Add the header after the creation
> {code}
> String metaData = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_METADATA, 
> String.class);
>             DBObject dbObject = (DBObject) JSON.parse(metaData);
>             gfsFile.setMetaData(dbObject);
>             gfsFile.save();
>             exchange.getIn().setHeader(Exchange.FILE_NAME_PRODUCED, 
> gfsFile.getFilename());
>             
> exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_FILE_ID_PRODUCED, 
> gfsFile.getId());
> {code}
> Of course I can create a PR myself, but I think the administrative work would 
> be more? Up to you guys.



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

Reply via email to