Articles → MONGODB → Combined Text Index In Mongodb
Combined Text Index In Mongodb
Purpose
Syntax
db.collection.createIndex(
{
field1: "text",
field2: "text",
// Add additional fields here if needed
}
)
Example
db.Employee.createIndex(
{
name: "text",
country: "text"
}
)
Output