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

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

问题描述

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查询[thread1]语法错误:丢失 :在属性ID @(shell):1:60之后

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

为什么? 预先谢谢你!

Why? Thank you in advance!

推荐答案

如果查询中包含内部文档,则使用引号.另外,请使用引号查询字符串值

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属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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