MongoDB Tutorial 0/120 lessons ~6 min read Lesson 64
Multikey Indexes
When you index an array field, MongoDB automatically creates a multikey index — one entry per array element.
Course progress0%
Focus
3 guided sections
Practice signal
Concept-first lesson
Career prep
Foundation builder
Introduction
When you index an array field, MongoDB automatically creates a multikey index — one entry per array element. This makes filtering by array contents fast.
Syntax reference
js
db.posts.createIndex({ tags: 1 });db.posts.find({ tags: "mongodb" });
Common mistakes
- Only one multikey field per compound index — can't combine two arrays.
Ready to mark this lesson complete?Track your journey across the entire course.