-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.6.5
-
Component/s: Querying
-
None
-
OS X
-
-
Query 10 (02/22/16)
I have a collection with a simple array of values and also with a nested collection. If I do a negative look-ahead $regex search on the documents with everything works fine but if I do the same search on documents with a nested collection it doesn't work. For example:
sample list collection
{ "_id": ObjectId("54deb2ed4e5018cf1c737b8d"), "values": [ "apples", "peaches", "bananas" ] } { "_id": ObjectId("54df5b40f546cf4c25013190"), "values": ["grapes", "oranges" ] } db.sampleList.count( { 'values':{$regex:"^(?<!appl).*", $options:'i '} }); // 1
sample nested collection
{ "_id": ObjectId("54e28b6caaadddb844d1f40a"), "values": [ { "value": " apple", "label": "Choice 1" }, { "value": "peach", "label": "Choice 2" }, { "value": "banana", "label": "Choice 3" }, { "value": "orange", "label": "Choice 4" } ] } { "_id": ObjectId("54eb580ee163c16b23145536"), "values": [ { "value": "orange", "label": "Choice 1" }, { "value": "banana", "label": "Choice 2" }, { "value": "peaches", "label": "Choice 3" }, { "value": "grapes", "label": "Choice 4" } ] db.sampleList.count( { 'values.value':{$regex:"^(?<!appl).*", $options:'i '} }); // 2