Docs Menu
Docs Home
/
Compass
/ /

Compass 의 지능형 어시스턴트

지능형 비서는 MongoDB Compass 의 통합 MongoDB 개발 지원 위해 설계된 AI 기반 도구입니다. 언어 질문에 답변하고, 오류 디버깅을 지원하며, 성능 최적화를 위한 지침 제공합니다.

참고

지능형 비서는 현재 공개 미리 보기로 제공됩니다.

MongoDB Compass 에서 지능형 비서를 사용하려면 먼저 설정에서 AI 기능을 활성화 .

1
운영 체제
설명
키보드 단축키

Windows / Linux

상단 메뉴 표시줄에서 Edit을 클릭합니다.

Ctrl + ,

macOS

상단 메뉴 표시줄에서 MongoDB Compass을 클릭합니다.

+ ,

2
3
4

MongoDB Compass의 생성형 인공지능 사용에 대한 자세한 내용은 다음을 참조하세요.

  • AI 및 데이터 사용량 정보

  • MongoDB 생성형 인공지능 기능에 대한 FAQ

MongoDB Compass 에서 AI 기능을 토글하는 방법에 대한 자세한 내용은 자연어 쿼리 활성화를 참조하세요.

MongoDB Compass 의 지능형 어시스턴트에 액세스 하려면 이 있는 사이드바 패널을 클릭하세요. 이렇게 하면 어시스턴트가 열리고 MongoDB Compass 연결 오류, 쿼리 출력, 설명 계획 통계 등과 관련된 다양한 질문을 할 수 있습니다.

|Compass| AI 드로어가 접힌 페이지
클릭하여 확대

그림 1. 어시스턴트가 있는 MongoDB Compass 홈페이지가 접혔습니다.

|Compass| AI 드로어가 열린 페이지
클릭하여 확대

그림 2. 어시스턴트가 확장된 MongoDB Compass 홈페이지.

다음 시나리오는 MongoDB Compass 에서 지능형 비서를 사용하는 여러 가지 방법을 보여줍니다.

연결 오류 메시지가 표시되면 MongoDB 어시스턴트를 사용하여 오류를 디버깅하라는 팝업이 표시됩니다. 'Debug for me'를 클릭하면 어시스턴트가 오류 진단을 위한 프롬프트를 자동으로 생성한다는 메시지가 표시됩니다.

Diagnose why my Compass connection is failing and help me debug it.
Connection string (password redacted):
mongodb+srv://user:****@cluster0.pndqllj.mongodb.net/
Error message:
querySrv ECONNREFUSED
The error message querySrv ECONNREFUSED in MongoDB Compass typically
points to a network issue when Compass is trying to discover your Atlas
cluster using DNS SRV records in your connection string.
Here are the most common causes and solutions for this issue:
1. Incorrect Hostname or Cluster Name
- Ensure that the cluster hostname (cluster0.hrdfe.mongodb.net) in
your connection string matches what is shown in your Atlas dashboard.
- Typos or a deleted/renamed cluster will cause connection refusal.
2. Network Restrictions or Firewall Blocking
- Atlas clusters operate on port 27017. Compass must be able to reach that port through your network.
- Firewalls, VPNs, or proxies might block outbound connections to MongoDB Atlas.
- Try connecting from a different network/location to rule out local filtering.
- You can test if your network allows access to this port using http://portquiz.net:27017/.
3. DNS Issues
- Compass uses DNS to resolve the SRV record in the connect string. If your DNS settings are incorrect or your network blocks DNS SRV lookups, connection will fail.
Try restarting your computer or flushing your DNS cache.
4. Cluster Status
- Verify that your MongoDB Atlas cluster is running and not paused
or shut down.
5. Compass Version
- Make sure you’re using an up-to-date version of MongoDB Compass.
Atlas typically requires recent client versions.
Recommended Steps to Debug:
- Double-check your Atlas cluster name and hostname.
- Ensure your local firewall allows outbound connections to “*.mongodb.net” over port 27017.
- Check that the Atlas cluster is running (not paused).
- Make sure your connection string is correct.
- Use another network or device to see if the issue persists.
If you’re still having trouble after these checks, please provide more
details about your environment (e.g., Compass version, operating system,
network setup), and I’ll be happy to help you further!
For further reading, I recommend checking the Compass troubleshooting
documentation, which covers these scenarios in detail before making any
major changes to your environment.

지능형 어시스턴트에게 MongoDB Compass 쿼리 의 출력을 분석 달라고 요청하세요.

Interpret this explain plan for me.
## Summary
- **Query Logic:** This pipeline counts the number of Italian restaurants in Manhattan by first filtering documents and then aggregating the count.
- **Performance:** Fair
- **Recommendations:** Create a compound index on `{ borough: 1, cuisine: 1 }` to optimize document retrieval.
## Details
### Query Logic
1. `$match`: Filters documents where `borough` is "Manhattan" and `cuisine` is "Italian".
2. `$count`: Counts the number of documents matching the filter and outputs the total.
### Performance Analysis
- The winning plan uses an index scan on the `cuisine` field (`cuisine_1`) and applies an in-memory filter for `borough` ("Manhattan").
- Both `totalKeysExamined` and `totalDocsExamined` are high (43,207), which implies that every document with `cuisine: "Italian"` is examined and then filtered by `borough`.
- No compound index exists, meaning MongoDB cannot efficiently combine both filter criteria in a single index lookup.
- The pipeline does properly filter before counting, but index usage is only partial, causing increased resource usage.
### Recommendations
- Create a compound index on `{ borough: 1, cuisine: 1 }` to allow MongoDB to retrieve documents matching both criteria directly from the index, minimizing documents examined.
- This optimization will reduce execution time and system load without changing the output of your aggregation pipeline.
Below is the recommended Aggregation Pipeline. This optimized Aggregation Pipeline will leverage the compound index to scan fewer documents, as both filter criteria are present in the index.
```json
[
{ "$match": { "borough": "Manhattan", "cuisine": "Italian" } },
{ "$count": "totalItalianRestaurants" }
]
```
### Follow-Up Questions
1. How do I create a compound index in MongoDB Compass or via a shell command?
2. What other fields should I consider adding to my indexes for restaurant lookups?
3. How can I further optimize aggregations when working with larger datasets?

다음 예제는 MongoDB Compass 함수 및 쿼리에 대해 지능형 어시스턴트에게 질문할 수 있는 질문을 보여줍니다.

How is MongoDB data modeling different from data modeling with a relational
database?
MongoDB data modeling differs from relational database (RDBMS) data
modeling in some important ways:
1. Document-Oriented vs. Table-Oriented
- MongoDB stores data as flexible, hierarchical JSON-like documents.
- Relational databases use tables with fixed schemas and columns.
2. Schema Flexibility
- In MongoDB, collections can contain documents with different structures. Schema enforcement is optional.
- RDBMS tables have a strict schema that enforces data types and relationships.
3. Embedding vs. Normalization
- MongoDB encourages embedding related data inside documents when appropriate (denormalization). Example: An order document may include an array of items directly inside it.
- Relational databases emphasize normalization—splitting data across tables connected by foreign keys.
4. Relationships
- MongoDB does support references between documents (similar to foreign keys), but joins are less central and not as efficient as in RDBMS.
- RDBMSs use normalized data and JOIN operations to relate tables efficiently.
5. Performance & Scaling
- MongoDB’s data model enables horizontal scaling (sharding), making it well-suited for large, distributed datasets.
- RDBMS scaling typically relies on vertical scaling or complex clustering; JOINs can become expensive as data grows.
6. Use Cases and Design Philosophy
- MongoDB models are often designed to optimize common query patterns, reducing the need for joins and complex queries.
- RDBMS models are designed for transactional consistency and for representing organized, well-structured relationships.
In summary, MongoDB encourages a more flexible, application-driven
approach to modeling, while relational databases rely on rigid schemas
and normalized relationships. Compass provides tools to visually explore
your document structures and relationships, which can be especially
helpful as your model evolves.
How can I combine multiple conditions in a single $search query?
To combine multiple conditions in a single $search query in MongoDB Atlas
Search (including Compass), you should use the compound operator. The
compound operator allows you to specify multiple criteria using must,
mustNot, filter, and should clauses.
Example: Combine Multiple Conditions
Suppose you want to:
- Match documents where the plot field contains "baseball"
- Exclude documents where the genres field contains "Comedy" or "Romance"
Your $search stage would look like this:
{
"$search": {
"compound": {
"must": [
{
"text": {
"query": "baseball",
"path": "plot"
}
}
],
"mustNot": [
{
"text": {
"query": ["Comedy", "Romance"],
"path": "genres"
}
}
]
}
}
}

돌아가기

프롬프트 애그리게이션

이 페이지의 내용