The _id field is always indexed. Additional indexes can be created with createIndex:


// Create an index on the name attribute
db.cities.createIndex( { name: 1 } );

// Create a compound index on country code and feature code
db.cities.createIndex( { country_code: 1, feature_code: 1 } );

// Create an index on the area field of timezone:
db.cities.createIndex( { 'timezone.area': 1 } );