| |
read source history
= index() =
----
[[MongoDB Driver Function Reference]]
Creates an index on the collection.
[[[@cG
<collection>.index(<name>, <field>[, ...])
]]]
**Arguments**
[[[@w
|@t0@r0@c0 <collection> | | The target collection. |
| <name> | | Index name |
| <field> | | Index field name. |
]]]
**Example**
[[[@cw
db.employees.index("salary_ix", "salary");
]]]
Creates an index for the //salary// key on the //employees// collection.
----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]
|