[SERVER-9590] Update $push + $sort should be able to sort by the whole array element Created: 06/May/13  Updated: 06/Mar/14  Resolved: 01/Oct/13

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 2.5.3

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 1
Labels: push, sort, update
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on DRIVERS-121 support new update operators Closed
Related
related to DOCS-2078 Support full $slice / $sort semantics... Closed
related to SERVER-8069 Support full $slice / $sort semantics... Closed
Participants:

 Description   

I am suggesting a way to sort by the elements not just some part of them ({$sort:{"field":order}}).

One possible syntax would be:

{$push:{$each:[...], $sort:-1}}// sort whole element, desc.



 Comments   
Comment by auto [ 01/Oct/13 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-9590 SERVER-8069: make sure to validate $sort number for $push and remove old invalid tests
Branch: master
https://github.com/mongodb/mongo/commit/8bcb0be94d3f1add3fc11e859be1f87c1e507e46

Comment by auto [ 01/Oct/13 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-9590 SERVER-8069: $push with $slice and/or $sort, and element sorting
Branch: master
https://github.com/mongodb/mongo/commit/fff69fa431248586ee4ccfdb0c43960040421558

Generated at Thu Feb 08 03:20:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.