ensure

English [?n'???(r)] American [?n???r]

vt. ] US [??n?d?ks]

n. ??; ???? vt. ??...;

vi.[??]???

MongoDB verifyIndex() ??? ???

??: MongoDB? verifyIndex() ???? ???? ???? ?????.

??: >db.COLLECTION_NAME.ensureIndex({KEY:1}) ???? Key ?? ????? ??? ??? ?? 1? ??? ???? ?????? ????? ?????. ?????? ???? ????? -1?? ????? ??????.

MongoDB verifyIndex() ??? ?

>db.col.ensureIndex({"title":1})
>
ensureIndex() 方法中你也可以設(shè)置使用多個字段創(chuàng)建索引(關(guān)系型數(shù)據(jù)庫中稱作復(fù)合索引)。

>db.col.ensureIndex({"title":1,"description":-1})
>