Preview & Explain
อธิบายความแตกต่างระหว่าง preview ที่ตรวจสอบ DSL query/pipeline ก่อนการดำเนินการและ explain ที่ขอแผนการดำเนินการจริงของ MongoDB
preview()
preview() จะไม่ดำเนินการ query กับ MongoDB แต่จะเรนเดอร์ query/pipeline ที่สร้างโดย DSL ปัจจุบันเป็น Document สำหรับการวินิจฉัย นี่คือ API ที่ใช้ตรวจสอบผลลัพธ์การสร้าง ไม่ใช่แผนการดำเนินการจริง
• classic findAll, find, count, exists, distinct
• root aggregation()
• Atlas Search findAll/find/count/existsQuery
• Vector Search findAll/find/count/existsQuery
explain()
explain() จะดำเนินการอธิบายจริงของ MongoDB Driver ดังนั้นจึงต้องการการเชื่อมต่อฐานข้อมูล
สามารถส่งค่าของ ExplainVerbosity เช่น QUERY_PLANNER, EXECUTION_STATS, ALL_PLANS_EXECUTIONS ของ Driver ได้โดยตรง