-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
I know that MongoDB 2.6 is quite an old version, and the issue is not present in the newest MongoDB 3.2, but I can't switch to MongoDB 3.2 easily. I wonder if there is any workaround?
The following script exposes the problem:
#!/bin/bash DB="test" mongo <<__EOF use $DB db.e.drop() db.e.insert({"key1": "some-val-1", "key2": "some-val-2"}) db.e.createIndex({'key1': 1}) db.e.createIndex({'key2': 1}) db.runCommand({"planCacheClearFilters": "e"}) db.runCommand({"planCacheSetFilter": "e", "query": {"key1": 1, "key2": 1}, "indexes": [ {"key1": 1} ]}) db.runCommand({"planCacheSetFilter": "e", "query": {"key1": 1, "key2": 1}, "projection": {"key1": 1}, "indexes": [ {"key1": 1} ]}) db.runCommand({"planCacheListFilters": "e"}) __EOF mongo <<__EOF exp1 = db.e.find({"key1": "val1", "key2": "val2"}).explain() exp2 = db.e.find({"key1": "val1", "key2": "val2"}, {"key1": 1}).explain() print("MongoClient no projection: " + exp1.filterSet) print("MongoClient projection: " + exp2.filterSet) __EOF python <<__EOF from pymongo import MongoClient cl = MongoClient() db = cl["$DB"] e = db['e'] curs = e.find({"key1": "val1", "key2": "val2"}) print "Python no projection:", curs.explain()['filterSet'] curs = e.find({"key1": "val1", "key2": "val2"}, projection=["key1"]) print "Python projection:", curs.explain()['filterSet'] __EOF
- duplicates
-
SERVER-13008 Encoding of projection for query plan cache should be type-insensitive
- Closed