-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.7, 4.0.3
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
v4.0, v3.6
-
-
Query 2018-11-19, Query 2018-12-03
Observed on 3.6.7. I haven't checked if previous/later versions are also affected.
It seems that a $match stage following $listSessions is ignored.
Without $match stage:
Josefs-MacBook-Pro(mongos-3.6.7)[mongos] config> db.system.sessions.aggregate( [ { $listSessions: { allUsers: true } } ], {cursor:{}} ) { "cursor": { "id": NumberLong("0"), "ns": "config.system.sessions", "firstBatch": [ { "_id": { "id": UUID("fade4449-fde7-482f-8885-eadba6cdfdc0")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:19:14.542Z") }, { "_id": { "id": UUID("e048de11-40bd-4c9a-9d49-57312a7038a3")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:24:07.797Z") }, { "_id": { "id": UUID("282ffe3c-d93a-414b-9a4a-69169689fdee")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:24:07.797Z") } ] }, "ok": 1, "operationTime": Timestamp(1537356383, 1), "$clusterTime": { "clusterTime": Timestamp(1537356388, 1), "signature": { "hash": BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId": NumberLong("0") } } }
With $match stage:
Josefs-MacBook-Pro(mongos-3.6.7)[mongos] config> db.system.sessions.aggregate( [ { $listSessions: { allUsers: true } }, {"$match":{ "_id.id":UUID("e048de11-40bd-4c9a-9d49-57313") }} ], {cursor:{}} ) { "cursor": { "id": NumberLong("0"), "ns": "config.system.sessions", "firstBatch": [ { "_id": { "id": UUID("fade4449-fde7-482f-8885-eadba6cdfdc0")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:19:14.542Z") }, { "_id": { "id": UUID("e048de11-40bd-4c9a-9d49-57312a7038a3")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:24:07.797Z") }, { "_id": { "id": UUID("282ffe3c-d93a-414b-9a4a-69169689fdee")), "uid": BinData(0, "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse": ISODate("2018-09-19T11:24:07.797Z") } ] }, "ok": 1, "operationTime": Timestamp(1537356383, 1), "$clusterTime": { "clusterTime": Timestamp(1537356383, 1), "signature": { "hash": BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId": NumberLong("0") } } }