How to Query MongoDB如何查询MongoDB

Posted on: 01/10/2018 (last updated: 09/03/2022) by Dakota Karlsson

Whether you’re a seasoned professional or a rough-around the edges rookie, querying in MongoDB has never been easier. 无论你是一名经验丰富的专业人士,还是一名粗犷的新手,在MongoDB中查询从来都不容易。Studio 3T offers the following ways to query MongoDB:Studio 3T提供了以下查询MongoDB的方法:

Make use of the Visual Query Builder or write your query in SQL. 使用可视化查询生成器或用SQL编写查询。Create an aggregate query in the Aggregation Editor or use the revamped IntelliShell to navigate through your data!在聚合编辑器中创建聚合查询,或使用改进的IntelliShell浏览数据!

Check out these guides for specific query functions in Studio 3T:有关Studio 3T中的特定查询功能,请参阅以下指南:

Visual Query Builder – Drag, Drop, and Query可视化查询生成器-拖放和查询

The Visual Query Builder is the easiest way to begin querying.“可视化查询生成器”是开始查询的最简单方法。

https://player.vimeo.com/video/681881851

If you’re new to MongoDB, use the Visual Query Builder to drag and drop fields, so you can run your very first query even without knowing MongoDB query syntax.如果您是MongoDB新手,请使用“可视化查询生成器”拖放字段,这样即使不了解MongoDB查询语法,也可以运行第一次查询。

And even if you’re an experienced MongoDB user, you can still use the Visual Query Builder to query arrays or build more complex queries.即使您是经验丰富的MongoDB用户,也可以使用可视化查询生成器查询数组或构建更复杂的查询。

View the full Visual Query Builder documentation.查看完整的可视化查询生成器文档。

SQL Query – The Familiarity of SQL in MongoDBSQL查询——熟悉MongoDB中的SQL

If you’re a SQL expert transitioning to MongoDB, you’ll feel right at home with the SQL Query feature.如果您是一位正在过渡到MongoDB的SQL专家,那么使用SQL查询功能将让您感到宾至如归。

Write the same familiar SQL inner and left joins and expressions like SELECT, SELECT DISTINCT, ORDER BY, GROUP BY – and much more – to query MongoDB.编写同样熟悉的SQL内部和左侧联接以及表达式,如SELECTSELECT DISTINCTORDER BYGROUP BY等,以查询MongoDB。

https://player.vimeo.com/video/681925640

Here’s the comprehensive guide to using SQL in MongoDB下面是在MongoDB中使用SQL的全面指南

IntelliShell – The Responsive mongo Shell响应式的mongo Shell

For those accustomed to working in the mongo shell, Studio 3T offers IntelliShell – a mongo shell with auto-completion of JavaScript functions, command helpers, and much, much more.对于那些习惯在mongo shell中工作的人来说,Studio 3T提供了IntelliShell——一个自动完成JavaScript函数、命令助手等功能的mongo shell。

https://www.youtube-nocookie.com/embed/lMqihBevbNE

Here’s the full IntelliShell documentation.以下是完整的IntelliShell文档

Aggregation Editor – The MongoDB Aggregation Query Builder聚合编辑器-MongoDB聚合查询生成器

Instead of writing complex aggregation queries in the mongo shell, the Aggregation Editor lets you build them one stage at a time for easier debugging.聚合编辑器不需要在mongo shell中编写复杂的聚合查询,而是让您一次只构建一个阶段,以便于调试。

https://player.vimeo.com/video/681876283

https://player.vimeo.com/video/681887647

Want to start creating your first aggregation query? 要开始创建第一个聚合查询吗?Here’s a tutorial that uses real-life data from the city of Chicago.这是一个使用芝加哥市真实数据的教程