Thuta Learning
ရှာဖွေရန်
AdvancedData & Databasesintermediate

Indexes

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

Indexes များသည် MongoDB ၏ query performance ကို မြှင့်တင်ရန် အထူး data structures များဖြစ်သည်။ Index မရှိပါက MongoDB သည် collection တစ်ခုလုံးကို scan လုပ်ရသည် (collection scan)။ Index ရှိပါက query သည် index ကို အသုံးပြုပြီး data များကို ပိုမိုလျင်မြန်စွာ ရှာဖွေနိုင်သည်။

javascript
// Create a single field index on the 'item' field
db.inventory.createIndex( { item: 1 } )

// 1 for ascending order, -1 for descending order
You should see
(item field တွင် index တစ်ခု တည်ဆောက်ပြီးသွားမည်။ ဤ field ဖြင့် ရှာဖွေပါက ပိုမိုမြန်ဆန်လာမည်)
Indexes | Thuta Learning