mongo Shell 中的查询给出 SyntaxError: missing : after property [英] query in mongo Shell gives SyntaxError: missing : after property

查看:101
本文介绍了mongo Shell 中的查询给出 SyntaxError: missing : after property的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

db.movieDetails.find(
  { year: 2013, imdb.rating: Pg-13, award.wins: 0 },
  { title: 1, _id: 0 }
).pretty();

mongo shell 返回这个错误

The mongo shell returns this error

2016-08-13T09:08:00.648+0200 E QUERY [thread1] 语法错误:缺失: 在属性 id @(shell):1:60

2016-08-13T09:08:00.648+0200 E QUERY [thread1] SyntaxError: missing : after property id @(shell):1:60

为什么?提前谢谢你!

推荐答案

如果您的查询包含内部文档,则为它们使用引号.另外,使用引号来查询字符串值

If your query includes inner documents, then use quotes for them. Also, use quotes for querying String values

db.movieDetails.find(
  { year: 2013, "imdb.rating": "Pg-13", "award.wins": 0 },
  { title: 1, _id: 0 }
).pretty();

这篇关于mongo Shell 中的查询给出 SyntaxError: missing : after property的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆