Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 25BB9200B23 for ; Sat, 4 Jun 2016 11:08:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 247C1160A4E; Sat, 4 Jun 2016 09:08:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A75C8160A58 for ; Sat, 4 Jun 2016 11:08:00 +0200 (CEST) Received: (qmail 69706 invoked by uid 500); 4 Jun 2016 09:07:59 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 69566 invoked by uid 99); 4 Jun 2016 09:07:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jun 2016 09:07:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 59FB42C1F6B for ; Sat, 4 Jun 2016 09:07:59 +0000 (UTC) Date: Sat, 4 Jun 2016 09:07:59 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-10019) camel-mongodb - Consider sortBy header when performing findOneByQuery operation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 04 Jun 2016 09:08:01 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-10019: -------------------------------- Fix Version/s: 2.18.0 2.17.2 > camel-mongodb - Consider sortBy header when performing findOneByQuery operation > ------------------------------------------------------------------------------- > > Key: CAMEL-10019 > URL: https://issues.apache.org/jira/browse/CAMEL-10019 > Project: Camel > Issue Type: Improvement > Components: camel-mongodb > Affects Versions: 2.17.1 > Reporter: Kris Boutilier > Priority: Trivial > Fix For: 2.17.2, 2.18.0 > > > 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)