SyntaxError:未终止的字符串文字-MongoDB聚合查询

时间:2019-05-18 02:31:47

标签: mongodb

下面是我的mongodb聚合查询,它抛出错误

SyntaxError:未终止的字符串文字@(shell):12:7

db.movies.aggregate([
{
   $match: {
           "countries" : {$in : ["USA"] },
           "tomatoes.viewer.rating" : {"$gte" : 3 }
          }
},
{ 
   $project: {
          "num_favs" : { "$filter": {
                                      input: "$cast" ,
                                       as: "num",
                                       cond: { $in:["$$num", [ "Sandra Bullock",
                                                               "Tom Hanks",
                                                               "Julia Roberts",
                                                               "Kevin Spacey",
                                                               "George Clooney"] ]}
                                   }
                       }
        }
}

]);

馆藏的样本记录

{
        "_id" : ObjectId("573a1390f29313caabcd421c"),
        "title" : "A Turn of the Century Illusionist",
        "year" : 1899,
        "runtime" : 1,
        "cast" : [
            "Georges M�li�s"
        ],
        "lastupdated" : "2015-08-29 00:21:21.547000000",
        "type" : "movie",
         "directors" : [
            "Georges M�li�s"
         ],
        "imdb" : {
            "rating" : 6.6,
            "votes" : 580,
            "id" : 246
        },
        "countries" : [
            "France"
        ],
        "genres" : [
            "Short"
        ],
        "tomatoes" : {
                "viewer" : {
                       "rating" : 3.8,
                        "numReviews" : 32
                },
                "lastUpdated" : ISODate("2015-08-20T18:46:44Z")
        }
    }

知道我想念的是什么吗?

0 个答案:

没有答案