I have the following MongoDB document strucutre:
{
"_id" : ObjectId("570b43bae4b0a33a2d7"),
"id" : "1175",
"data" : [ 
    {
        "name" : "tim",
        "email" : "tim@gmail.com",
        "id" : "1173",
        "x1" : 12.951
    }, 
    {
        "name" : "alex",
        "email" : "alex@gmail.com",
        "id" : "1096",
        "x1" : 12.926
    }, ]}
I want to filter out "data" array so that values of "x1" greater than 12.93 are selected. I want the following result after querying:
{
"_id" : ObjectId("570b43bae4b0a33a2d7"),
"id" : "1175",
"data" : [ 
    {
        "name" : "tim",
        "email" : "tim@gmail.com",
        "id" : "1173",
        "latitude" : 12.951
    }]} 
I ran the following query in mongo shell as instructed in MongoDB official manual
db.getCollection('mydatabase').aggregate(
         [{  $project:  {  data : { $filter: {   input: "$data", as : "item", cond:{   $gte: [ "$$item.x1" ,12.93]  } } } } }] )
I am getting the following error:
assert: command failed: { "errmsg" : "exception: invalid operator '$filter'", "code" : 15999, "ok" : 0 }
Why am I getting this error? How to resolve this error?
 
    