You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/06/09 18:02:21 UTC

[jira] [Commented] (CAMEL-10023) camel-mongodb - Consider sortBy header when performing findOneByQuery operation

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

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

Github user kb1ca closed the pull request at:

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


> camel-mongodb - Consider sortBy header when performing findOneByQuery operation
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-10023
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10023
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-mongodb
>    Affects Versions: 2.17.1
>            Reporter: Kris Boutilier
>            Assignee: Claus Ibsen
>            Priority: Trivial
>             Fix For: 2.17.2
>
>
> There is a often a requirement to fetch the min/max record from Mongo based on a particular field. Typically the operation is performed using syntax similar to:
>   db.collection.find().sort({_id: -1}).limit(1)
>  or
>   db.collection.findOne({$query:{},$orderby:{_id:-1}})
> As implemented the findOneByQuery operation currently ignores the sortBy header. This trivial patch passes sortBy to the sort parameter of findOne(), if set.
> Helpfully, if the projection parameter is null findOne() returns all fields, so the state of fieldFilter is not checked before passing when the sortBy header has been set.



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