在Heroku上调用api时无法识别的表达式'$ trim'

时间:2018-10-24 03:27:20

标签: mongodb heroku

这是我的功能api部署到heroku:

PreferenceCategory

我测试它可以在我的本地主机robo3T中正常工作,例如:

getMovieStyle1(req, res, next) {
        const { movieStyle } = req.query;

        // const today = new Date().toISOString().slice(0, 10);
        // must be TaipeiEast
        const cityCollection = mongoose.model('TaipeiEast', MovieSchema, 'TaipeiEast');

        cityCollection.aggregate([
            { "$match": {
                  "theater": "Centuryasia"
                }
            },
            {                
               "$project": { 
                  theater: true,
                  theaterCn: true,
                  movie: {
                    $filter: {
                      input: {
                        $map: {
                          input: "$movie",
                          as: "movie",
                          in: {
                              cnName: "$$movie.cnName",
                              enName: "$$movie.enName",
                              versionType: "$$movie.versionType",
                              movieStyle: {
                                $filter: {
                                  input: "$$movie.movieStyle",
                                  as: "movieStyle",
                                  cond: {
                                    $in: [
                                      {
                                        $trim: {
                                          input: "$$movieStyle"
                                        }
                                      },
                                      movieStyle
                                    ]
                                  }
                                }
                              }
                          }
                        }
                      },
                      as: "movie",
                      cond: "$$movie"
                    }
                  }
              }
            }
        ])
            .then(drivers => res.send(drivers))
            .catch(next);

    },

但是当我调用我的api db.getCollection('TaipeiEast').aggregate([ etc...

getMovieStyle1

我得到了错误:

https://obscure-reaches-65656.herokuapp.com/api/getMovieStyle1?movieStyle["Action","Advantage"]

我不知道在我的Heroku服务器中使用{ "error": "Unrecognized expression '$trim'" } 有什么问题。

任何帮助将不胜感激。预先感谢。

0 个答案:

没有答案