Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Done
-
3.4.1, 3.5.1
-
Fully Compatible
-
ALL
-
v3.4
-
Query 2017-02-13
Description
If you create an identity view on a collection which has some field that contains an array, the result of db.collection.distinct("thatfield") and db.identityview.distinct("thatfield") will not be the same.
db.coll.find()
|
{ "_id" : ObjectId("5876aaed34e6e16cd498d61c"), "a" : 1 }
|
{ "_id" : ObjectId("5876aaf034e6e16cd498d61d"), "a" : [ 2 ] }
|
{ "_id" : ObjectId("5876aaf734e6e16cd498d61e"), "a" : [ 3, 4 ] }
|
db.coll.distinct("a")
|
[ 1, 2, 3, 4 ]
|
db.createView("view","coll",[])
|
{ "ok" : 1 }
|
agg@127.0.0.1:27017(3.4.1) > db.view.distinct("a")
|
[ [ 3, 4 ], [ 2 ], 1 ]
|
Attachments
Issue Links
- is related to
-
SERVER-55112 Behaviour of distinct differs between collections and views
-
- Closed
-
- related to
-
SERVER-27484 allow $setUnion in $group
-
- Closed
-