Skip to content

UpdateFirst with query has sort order not working [DATAMONGO-1704] #2616

Closed
@spring-projects-issues

Description

@spring-projects-issues

RAJESH GUPTA opened DATAMONGO-1704 and commented

Hi Team,
I am using Spring Mongo operations and I want to use updateFirst() command. In this method we have to pass the query with criteria. The query has some criterias with Sort Order also but during the updateFirst() it doesn't include the order


Issue Links:

  • DATAMONGO-1731 Improve JavaDoc of MongoOperations update / findAndModify methods

Activity

spring-projects-issues

spring-projects-issues commented on Jul 4, 2017

@spring-projects-issues
Author

Christoph Strobl commented

Thank you RAJESH GUPTA.
updateFirst triggers db.collection.updateOne which does not have sort.
However you might want to try findAndModify which will take sort into account by using db.collection.findOneAndUpdate operation.

I've opened DATAMONGO-1731 to tweak documentation

spring-projects-issues

spring-projects-issues commented on Jan 6, 2021

@spring-projects-issues
Author

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues

spring-projects-issues commented on Jan 13, 2021

@spring-projects-issues
Author

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

in: coreIssues in core supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @christophstrobl@spring-projects-issues

      Issue actions

        UpdateFirst with query has sort order not working [DATAMONGO-1704] · Issue #2616 · spring-projects/spring-data-mongodb