-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.2.11
-
Component/s: Aggregation Framework
-
None
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
My collection containes documents as follow:
*****************************************************************
/* 1 */
/* 2 */
{ "_id" : ObjectId("591dae83e320467808f1e199"), "scenario" : "delc", "datavalue" : [ " _value: ", "A _value: 4", "B _value: 5", "C _value: 92", "D _value:94" ] }/* 3 */
{ "_id" : ObjectId("591dae9ae320467808f1e19a"), "scenario" : "delc", "datavalue" : [ " _value: ", "A _value: 2", "C _value: 2", "D _value:4" ] }**********************************************************************
When I want to search for "datavalue grater than A _value: 6" it does not work (returns all the documents) with simple $match $project as follow :
*************************************************
db.getCollection('test').aggregate([
{$match : {datavalue :
}},
{ $project: { scenario: 1,
datavalue: { $filter: { input: "$datavalue", as: "datavalue",
cond: {
$or: [ { $eq: [
, "A" ] } ] } } }
} }])
*************************************************
If I add another $match (the same as the first one) to the pipeline the results are OK, but if I add a condition "searching for documents with datavalue grater than A _value: 6 and datavalue starts with B" it returns all the documents (I attached an image)