SHOW:
|
|
- or go back to the newest paste.
| 1 | db.ensureIndex( { 'a.b':1, 'a.c':1 } );
| |
| 2 | ------------------------------------------------------------------ | |
| 3 | - | Mongo > db.test.find({ a:{ $elemMatch:{ b:1, c:20 } } } ).explain()
|
| 3 | + | |
| 4 | 2.4.1 | |
| 5 | Mongo > db.test.find({ a:{ $elemMatch:{ b:1, c:20 } } } ).explain() // index bound works perfectly
| |
| 6 | {
| |
| 7 | "cursor" : "BtreeCursor a.b_1_a.c_1", | |
| 8 | "isMultiKey" : true, | |
| 9 | "n" : 0, | |
| 10 | "nscannedObjects" : 0, | |
| 11 | "nscanned" : 0, | |
| 12 | "nscannedObjectsAllPlans" : 0, | |
| 13 | "nscannedAllPlans" : 0, | |
| 14 | "scanAndOrder" : false, | |
| 15 | "indexOnly" : false, | |
| 16 | "nYields" : 0, | |
| 17 | "nChunkSkips" : 0, | |
| 18 | "millis" : 0, | |
| 19 | "indexBounds" : {
| |
| 20 | "a.b" : [ | |
| 21 | [ | |
| 22 | 1, | |
| 23 | 1 | |
| 24 | ] | |
| 25 | ], | |
| 26 | "a.c" : [ | |
| 27 | [ | |
| 28 | 20, | |
| 29 | 20 | |
| 30 | ] | |
| 31 | ] | |
| 32 | }, | |
| 33 | "server" : "bdvlpabhishekk:27016" | |
| 34 | } | |
| 35 | ------------------------------------------------------------------ | |
| 36 | - | Mongo > db.test2.find({ a:{ $elemMatch:{ b:1, c:20 } } } ).explain()
|
| 36 | + | |
| 37 | 2.2.0 | |
| 38 | Mongo > db.test2.find({ a:{ $elemMatch:{ b:1, c:20 } } } ).explain() // check the index bound, not working as expected
| |
| 39 | {
| |
| 40 | "cursor" : "BtreeCursor a.b_1_a.c_1", | |
| 41 | "isMultiKey" : true, | |
| 42 | "n" : 0, | |
| 43 | "nscannedObjects" : 1, | |
| 44 | "nscanned" : 1, | |
| 45 | "nscannedObjectsAllPlans" : 1, | |
| 46 | "nscannedAllPlans" : 1, | |
| 47 | "scanAndOrder" : false, | |
| 48 | "indexOnly" : false, | |
| 49 | "nYields" : 0, | |
| 50 | "nChunkSkips" : 0, | |
| 51 | "millis" : 0, | |
| 52 | "indexBounds" : {
| |
| 53 | "a.b" : [ | |
| 54 | [ | |
| 55 | 1, | |
| 56 | 1 | |
| 57 | ] | |
| 58 | ], | |
| 59 | "a.c" : [ | |
| 60 | [ | |
| 61 | {
| |
| 62 | "$minElement" : 1 | |
| 63 | }, | |
| 64 | {
| |
| 65 | "$maxElement" : 1 | |
| 66 | } | |
| 67 | ] | |
| 68 | ] | |
| 69 | }, | |
| 70 | "server" : "bdvlpabhishekk:27017" | |
| 71 | } | |
| 72 | ||
| 73 | - | Mongo > db.test.find( { 'a.b':1, 'a.c':2 } ).explain()
|
| 73 | + | |
| 74 | Mongo > db.version() | |
| 75 | 2.4.1 | |
| 76 | Mongo > db.test.find( { 'a.b':1, 'a.c':2 } ).explain() // check the index bounds, not working as expected
| |
| 77 | {
| |
| 78 | "cursor" : "BtreeCursor a.b_1_a.c_1", | |
| 79 | "isMultiKey" : true, | |
| 80 | "n" : 1, | |
| 81 | "nscannedObjects" : 1, | |
| 82 | "nscanned" : 1, | |
| 83 | "nscannedObjectsAllPlans" : 1, | |
| 84 | "nscannedAllPlans" : 1, | |
| 85 | "scanAndOrder" : false, | |
| 86 | "indexOnly" : false, | |
| 87 | "nYields" : 0, | |
| 88 | "nChunkSkips" : 0, | |
| 89 | "millis" : 0, | |
| 90 | "indexBounds" : {
| |
| 91 | "a.b" : [ | |
| 92 | [ | |
| 93 | 1, | |
| 94 | 1 | |
| 95 | ] | |
| 96 | ], | |
| 97 | "a.c" : [ | |
| 98 | [ | |
| 99 | {
| |
| 100 | "$minElement" : 1 | |
| 101 | }, | |
| 102 | {
| |
| 103 | "$maxElement" : 1 | |
| 104 | } | |
| 105 | ] | |
| 106 | ] | |
| 107 | }, | |
| 108 | "server" : "bdvlpabhishekk:27016" | |
| 109 | } | |
| 110 | ------------------------------------------------------------------ |