PS C:\> docker run --name mongodb-bug -p 31017:27017 -d mongo:6.0.17 e47c467b1eb52144516016f527ca24cc2406c6376248c3663a0f43b2a36f1470 PS C:\> docker inspect mongo:6.0.17 [ { "Id": "sha256:2835e1541e708cfe27676f8a61a1ca93a1d21f0dbdd03fb30d2780bd7a64ef0f", "RepoTags": [ "mongo:6.0.17" ], "RepoDigests": [ "mongo@sha256:5426e97e68aa428bcbdcaad0ec21cb3c8f0f473a9665fc051fb3c8feed31331b" ], "Parent": "", "Comment": "buildkit.dockerfile.v0", "Created": "2024-08-21T22:11:36Z", "Container": "", "ContainerConfig": { "Hostname": "", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": null, "Cmd": null, "Image": "", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": null }, "DockerVersion": "", "Author": "", "Config": { "Hostname": "", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "27017/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "GOSU_VERSION=1.17", "JSYAML_VERSION=3.13.1", "MONGO_PACKAGE=mongodb-org", "MONGO_REPO=repo.mongodb.org", "MONGO_MAJOR=6.0", "MONGO_VERSION=6.0.17", "HOME=/data/db" ], "Cmd": [ "mongod" ], "ArgsEscaped": true, "Image": "", "Volumes": { "/data/configdb": {}, "/data/db": {} }, "WorkingDir": "", "Entrypoint": [ "docker-entrypoint.sh" ], "OnBuild": null, "Labels": { "org.opencontainers.image.ref.name": "ubuntu", "org.opencontainers.image.version": "22.04" } }, "Architecture": "amd64", "Os": "linux", "Size": 715804278, "VirtualSize": 715804278, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/ce42408286c951342532008eecb772abb4951bdd531cdcad412404a7ee1e2a88/diff:/var/lib/docker/overlay2/ec79f974858571845933f1f7202e11eb6c76ccb7e66ff628e53a8d09c73befb4/diff:/var/lib/docker/overlay2/621b3a0db91095ea0f38b4ee5b935b4db690922101529ab9b613fa2baad21c58/diff:/var/lib/docker/overlay2/8da21974438820992d323ee38494e2cfd8a78afc74086301ba3d09e60132d5c6/diff:/var/lib/docker/overlay2/ee440175df5efc30d45504615c8a5ad1e7086b012bfd8d52f5751d8f834781f0/diff:/var/lib/docker/overlay2/bd6dd4e7340acc6ce77ddc5442295f99ad2276aa6566f6c4e9f85863f03a0784/diff:/var/lib/docker/overlay2/1f85461e2a5ca2488309f86f87d740acbd63dd95b7b9d4b286a9e4ea46d7b81a/diff", "MergedDir": "/var/lib/docker/overlay2/ecad3cfa24326c6af4ecdaa1e514f95708f1cfffd37ef5e983a5be6578d38d9c/merged", "UpperDir": "/var/lib/docker/overlay2/ecad3cfa24326c6af4ecdaa1e514f95708f1cfffd37ef5e983a5be6578d38d9c/diff", "WorkDir": "/var/lib/docker/overlay2/ecad3cfa24326c6af4ecdaa1e514f95708f1cfffd37ef5e983a5be6578d38d9c/work" }, "Name": "overlay2" }, "RootFS": { "Type": "layers", "Layers": [ "sha256:2573e0d8158209ed54ab25c87bcdcb00bd3d2539246960a3d592a1c599d70465", "sha256:6fdb8268b81ee89812e55a9b19fbe711a042ffc826593eb8ae792e5194753830", "sha256:408ed138bfcd26d8c043f473a627a945ef56f18055a1859787dd75af01cd75d5", "sha256:9ec6f6946d3ace58543d9c884edf3b2b801f15651b1c865729d45474b01c2ba1", "sha256:a0275c90e805cd0f84af7c4c57830d74445468031069876f757545491848ed6c", "sha256:99963defca24a72a36005077b55900236153e7d445f998f6c5e314e55cbe58d8", "sha256:c0d894323c5ed40ae7eaaa1de50d216882812e6465ff2c608e70724b921f8b47", "sha256:437db1be8863cdbf638cf0c3c1f4e8d7e9231e97abb5193090b6d443fce2c48a" ] }, "Metadata": { "LastTagTime": "0001-01-01T00:00:00Z" } } ] PS C:\> docker exec -t -i mongodb-bug mongosh Current Mongosh Log ID: 66e9ddef65ae322e41964032 Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.3.1 Using MongoDB: 6.0.17 Using Mongosh: 2.3.1 For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/ To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy). You can opt-out by running the disableTelemetry() command. ------ The server generated these startup warnings when booting 2024-09-17T19:52:06.469+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem 2024-09-17T19:52:07.401+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted 2024-09-17T19:52:07.401+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never' in this binary version 2024-09-17T19:52:07.401+00:00: vm.max_map_count is too low ------ test> for (var i = 0; i < 5000; i++) { db.agg_col.insertOne({ "_id": UUID(), "Foo": UUID() }); } { acknowledged: true, insertedId: UUID('60f055b2-dc60-4332-b952-8b4ba8d948cb') } test> test> var foo1kIds = db.getCollection("agg_col").find({}, { "Foo" : 1.0, "_id" : 0.0 }).limit(1000).map(function(el) { return el.Foo }).toArray(); test> test> var foo2kIds = db.getCollection("agg_col").find({}, { "Foo" : 1.0, "_id" : 0.0 }).limit(2000).map(function(el) { return el.Foo }).toArray(); test> test> db.getCollection("agg_col").aggregate( [ { "$match" : { "$and" : [ { "Foo" : { "$in" : foo1kIds } } ] } }, { "$group" : { "_id" : { "Foo" : "$Foo" }, "Count": {$sum:1} } } ] ); [ { _id: { Foo: UUID('f21e9088-e326-4ebe-bbfd-e1138bb1e6d5') }, Count: 1 }, { _id: { Foo: UUID('10743196-f9bd-4099-a035-1616483aba31') }, Count: 1 }, { _id: { Foo: UUID('fb39e5e0-75b6-4212-8c20-4b0b75f1059a') }, Count: 1 }, { _id: { Foo: UUID('ec96338c-e47e-4c82-8d8a-35b8785c02ab') }, Count: 1 }, { _id: { Foo: UUID('575bbac9-868f-434a-b592-fe79e6cf99e1') }, Count: 1 }, { _id: { Foo: UUID('878b0b62-6e0d-4ead-ae54-6d19bd7d0476') }, Count: 1 }, { _id: { Foo: UUID('d259d12b-4543-4675-8bb7-d6c08303b1a2') }, Count: 1 }, { _id: { Foo: UUID('bffb0871-a09d-4ff7-8d0d-c14c578d91ff') }, Count: 1 }, { _id: { Foo: UUID('442fa0ef-80e9-496d-9b05-f7f2beca5efe') }, Count: 1 }, { _id: { Foo: UUID('e583cb88-47d6-4a00-958a-d3e07fef9166') }, Count: 1 }, { _id: { Foo: UUID('2f668c44-3e59-441f-ad16-68a4357a2be0') }, Count: 1 }, { _id: { Foo: UUID('8aa18569-0921-4429-be30-28e0d210c830') }, Count: 1 }, { _id: { Foo: UUID('4183a61d-766c-4fd4-af4f-17eefbe1afec') }, Count: 1 }, { _id: { Foo: UUID('b5949373-f4b1-445c-995e-3cbc5003005d') }, Count: 1 }, { _id: { Foo: UUID('eafc1fc0-21bc-4798-863e-4936c4c7e522') }, Count: 1 }, { _id: { Foo: UUID('453cecc1-c7fb-42de-a6f3-7acb0f87d13b') }, Count: 1 }, { _id: { Foo: UUID('d44edf46-cd0c-43dd-8cbb-8a3aadae76ff') }, Count: 1 }, { _id: { Foo: UUID('9520cd71-4b81-4513-89d3-227d997af4d8') }, Count: 1 }, { _id: { Foo: UUID('37924f9c-130b-47d1-abf5-7f1fb3855134') }, Count: 1 }, { _id: { Foo: UUID('558174f4-fd95-48bd-9d0e-2dcbaa43ec7a') }, Count: 1 } ] Type "it" for more test> test> db.getCollection("agg_col").aggregate( [ { "$match" : { "$and" : [ { "Foo" : { "$in" : foo2kIds } } ] } }, { "$group" : { "_id" : { "Foo" : "$Foo" }, "Count": {$sum:1} } } ] ); [ { Foo: UUID('e63f352d-c63e-4edc-9009-7a83ab823993') }, { Foo: UUID('6bf89563-d5a7-492f-95c4-1362630a7213') }, { Foo: UUID('2b8d3083-e8c0-4962-8d03-3e8186333090') }, { Foo: UUID('28978826-b576-4a0b-bd1e-fc9233eb969d') }, { Foo: UUID('3962d242-4156-49c0-8fb0-9b0b685ad15e') }, { Foo: UUID('a688ca9c-ec9c-43c4-bccf-a51acb639531') }, { Foo: UUID('37924f9c-130b-47d1-abf5-7f1fb3855134') }, { Foo: UUID('f90d70d0-c7a0-479c-84ab-f66172c1b19a') }, { Foo: UUID('2d3d5c8b-d7f9-4db5-b03f-01358c85f51f') }, { Foo: UUID('60d74ef5-ad73-4e35-a697-0852990b0c7a') }, { Foo: UUID('de9a09fb-96bd-430f-bfb7-732b6a5e50cf') }, { Foo: UUID('b03932df-55e5-4199-8bd1-ad3658303edc') }, { Foo: UUID('c33f4f90-fd03-42b5-9973-6390d777bcb9') }, { Foo: UUID('3e6fd60c-eafb-41bd-8652-27ebab2f372b') }, { Foo: UUID('ef46e44c-c747-483a-971d-82901c6d1ca4') }, { Foo: UUID('10cb78e0-a694-4203-bebe-7d17d8fae75e') }, { Foo: UUID('fa4f03ee-4577-4c72-8aa4-2b3f3314d9e3') }, { Foo: UUID('761268e4-98f7-4740-83c8-750b2fdeec2a') }, { Foo: UUID('232c4adf-7a63-45cd-b0e3-c026f8b6deff') }, { Foo: UUID('4db069e2-d87e-4d97-8f99-2c1a2bdcda76') } ] Type "it" for more test> exit PS C:\>