[SERVER-14221] Distinct doesn't properly handle undefined literal Created: 10/Jun/14  Updated: 10/Dec/14  Resolved: 10/Jun/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.4.10, 2.6.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: David Storch Assignee: David Storch
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-2426 Convert/print bson undefined type as ... Closed
Operating System: ALL
Steps To Reproduce:

// Setup the data.
> t.drop()
> t.save({a: [{b: 1}, {b: undefined}]})
> t.save({a: {b: null}})
 
// The array returned from distinct should have unique elements. However,
// the output here repeats "null".
> t.distinct("a.b")
[ null, 1, null ]

Participants:

 Description   

There can be a repeated null element in the output array of the distinct command if a document contains a literal "undefined" element. See the repro steps for details.

This is not a regression due to the 2.6 query engine rewrite: it affects both 2.4 and 2.6 versions.



 Comments   
Comment by David Storch [ 10/Jun/14 ]

scotthernandez, I confirmed that this is just a display issue. Good catch! Resolving as a duplicate of SERVER-2426.

Comment by Scott Hernandez (Inactive) [ 10/Jun/14 ]

Are you sure it isn't just the javascript bug with undefined (being shown as null)? Can you test in another language?

SERVER-2426

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