If you are the Project Owner, you can create and modify a charts view. A charts view is a data source that applies an aggregation pipeline to a collection to pre-process data before it is used for Charts. You can create multiple charts views from a single collection.
차트 뷰를 만든 후 차트를 만들 때 차트 뷰를 데이터 소스로 선택할 수 있습니다.
사용 사례
파이프라인을 사용하여 데이터 소스를 사전 처리하는 것은 컬렉션 데이터가 데이터 시각화에 최적화되지 않은 경우에 유용합니다.
데이터를 사전 처리하면 다음 작업을 수행하는 데 도움이 될 수 있습니다.
Join data from multiple collections into a single data source using
$lookup. See example.Hide fields which may contain sensitive data from Charts users using
$project. See example.문자열 필드와 같은 데이터 유형을 날짜로 변환합니다. 예시를 참조하세요.
collection에서 Atlas Charts 뷰 만들기
배포를 연결합니다.
자세한 내용은 Atlas Charts에 배포서버 연결을 참조하세요.
(선택 사항) Test Pipeline을 클릭합니다.
Atlas Charts는 파이프라인의 유효성을 검사합니다. Atlas Charts는 편집기 아래 파이프라인의 오류를 보고합니다. 파이프라인이 유효하면 Atlas Charts는 결과의 샘플 문서를 표시하거나 No documents returned 을(를) 표시합니다.
팁
파이프라인 생성에 도움이 필요하면 Atlas 데이터 탐색기에서 집계 파이프라인 빌더를 활용할 수 있습니다.
Atlas 파이프라인 빌더를 사용하여 파이프라인을 생성하여 Atlas Charts 파이프라인 편집기에 붙여넣을 수 있습니다.
파이프라인 예시
두 collection의 데이터 조인
The following example adds a pipeline to a data source pointing to the sample_mflix.movies collection from the Sample Mflix Dataset provided by Atlas. The pipeline performs a $lookup to join data from the comments collection based on movie_id. The result is a new field in this data source called comments containing data from a separate collection.
[ { $lookup: { from: 'comments', localField: '_id', foreignField: 'movie_id', as: 'comments' } } ]
민감한 데이터 숨기기
The following example adds a pipeline to a data source pointing to the sample_supplies.sales collection from the Sample Supply Store Dataset provided by Atlas. The pipeline hides the customer.email field, making that field unavailable to charts using this data source:
[ { $project: { "customer.email": 0 } } ]
To learn more about the $project aggregation stage, see $project.
데이터 필드의 유형 변환
다음 예에서는 날짜로 변환하려는 문자열 필드가 포함된 데이터 소스에 파이프라인을 추가합니다. 파이프라인은 문자열 필드 saleDate 을 saleDateAsDate 이라는 날짜 필드로 변환된 데이터 소스에 새 필드를 추가합니다.
[ { $addFields: { saleDateAsDate: { $toDate: '$saleDate' } } } ]
Atlas Charts 뷰의 파이프라인 수정
배포를 연결합니다.
자세한 내용은 Atlas Charts에 배포서버 연결을 참조하세요.
차트 뷰의 파이프라인 편집하려면 Pipeline 탭 클릭합니다.
팁
이 페이지의 다른 설정에 대해 알아보려면 managed 데이터 소스를 참조하세요.
차트 뷰 연결 해제
Atlas Charts 뷰의 연결을 해제하려면 데이터 소스 연결 해제를 참조하세요.
Atlas Charts 뷰 삭제
If you are the Project Owner, you can permanently delete a charts view.
Atlas Charts 뷰를 삭제하려면 다음을 수행합니다.
배포를 연결합니다.
자세한 내용은 Atlas Charts에 배포서버 연결을 참조하세요.