Pymongo / MongoDB: create index or ensure index?

后端 未结 5 2059
温柔的废话
温柔的废话 2020-12-07 22:30

I don\'t understand the difference between create_index and ensure_index in pymongo. On the MongoDB indexes page, it says

yo

5条回答
  •  温柔的废话
    2020-12-07 23:01

    All indexes are permanent. ensure_index() is just a tiny wrapper around create_index().

    """ The ensureIndex() function only creates the index if it does not exist. """

    There is nothing like a transient index or a temporary index.

提交回复
热议问题