[SERVER-2317] Unindexed array field sorts incorrectly Created: 31/Dec/10  Updated: 31/Dec/10  Resolved: 31/Dec/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 1.7.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

//wrong order
db.games.find().sort(

{'decks.points': -1}

);
{ "_id" : "game-20101124-185512-c86779ce.html", "decks" : [

{ "points" : 64 }

,

{ "points" : 42 }

] }
{ "_id" : "game-20101124-171239-da3d89e2.html", "decks" : [

{ "points" : 63 }

,

{ "points" : 33 }

] }
{ "_id" : "game-20101124-204302-026f72ee.html", "decks" : [

{ "points" : 43 }

,

{ "points" : 36 }

,

{ "points" : 28 }

] }
{ "_id" : "game-20101124-083714-3cc1743c.html", "decks" : [

{ "points" : 47 }

,

{ "points" : 42 }

] }
{ "_id" : "game-20101124-013048-26973e9a.html", "decks" : [

{ "points" : 47 }

,

{ "points" : 29 }

] }

db.games.ensureIndex(

{"decks.points": -1}

)

//correct order
db.games.find().sort(

{'decks.points': -1}

);
{ "_id" : "game-20101124-185512-c86779ce.html", "decks" : [

{ "points" : 64 }

,

{ "points" : 42 }

] }
{ "_id" : "game-20101124-171239-da3d89e2.html", "decks" : [

{ "points" : 63 }

,

{ "points" : 33 }

] }
{ "_id" : "game-20101124-083714-3cc1743c.html", "decks" : [

{ "points" : 47 }

,

{ "points" : 42 }

] }
{ "_id" : "game-20101124-013048-26973e9a.html", "decks" : [

{ "points" : 47 }

,

{ "points" : 29 }

] }
{ "_id" : "game-20101124-204302-026f72ee.html", "decks" : [

{ "points" : 43 }

,

{ "points" : 36 }

,

{ "points" : 28 }

] }
> db.decks.dropIndex(

{'decks.points':-1}

 Comments   
Comment by Eliot Horowitz (Inactive) [ 31/Dec/10 ]

See SERVER-480

Generated at Thu Feb 08 02:59:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.