انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-042-L07

عرض عملي: بناء خدمة المراجعات على MongoDB

  • الدرس 7 من 7
  • Mid-level
في هذا الدرس 3 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

build the reviews service with a ratings summary. Prepares MID-042-LAB1.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Create the Review document and repository; add POST /products/{id}/reviews and GET for the latest 20.
  2. Add the compound index { productId: 1, createdAt: -1 } and prove IXSCAN with explain.
  3. Add GET /products/{id}/rating-summary using an aggregation ($match, $group average and count).
  4. Run it against 100 000 seeded reviews; compare timings with and without the index.
  5. Planned mistake: embed the review list inside a ProductReviews document; at a few thousand reviews updates slow down. Fix: one document per review and a separate summary.
  6. Use Testcontainers with a MongoDB image for the integration test (verify image tag).

اختبر فهمك

Where is the average computed?

أظهر الإجابة

In the database, by the aggregation pipeline.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.