[CSHARP-736] Don't cache EnsureIndex and deprecate CreateIndex Created: 29/Apr/13  Updated: 17/Dec/14  Resolved: 30/Apr/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.8.1
Fix Version/s: 1.8.2

Type: Improvement Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-4539 db.collection.createIndex() should no... Closed
related to DOCS-4540 db.collection.ensureIndex() should be... Closed
Backwards Compatibility: Minor Change

 Description   

EnsureIndex attempts to remember which indexes already exist in order to avoid a round trip to the server if possible. However, this is fragile because EnsureIndex can't know what's going on in other processes. It is better to just let the server decide if the index already exists or not.

Caching was the only difference between EnsureIndex and CreateIndex. Since these two methods now do the same thing we are deprecating CreateIndex (note that the shell deprecated createIndex as far back as version 1.8 of the server).



 Comments   
Comment by Craig Wilson [ 30/Jun/14 ]

I'm not sure about the shell. I was referring to the new createIndexes command: http://docs.mongodb.org/manual/reference/command/createIndexes/#dbcmd.createIndexes

Comment by Chad Kreimendahl [ 30/Jun/14 ]

Thanks... does that mean this will be changing by the doc team?

http://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/

Comment by Craig Wilson [ 30/Jun/14 ]

Nope, we flipped them. The server has gone with createIndex as the new command name for index creation, so we are naming ours similarly. CreateIndex is now correct.

Comment by Chad Kreimendahl [ 30/Jun/14 ]

It appears that EnsureIndex got deprecated and suggests we use CreateIndex.. but that appears wrong:?

Comment by auto [ 30/Apr/13 ]

Author:

{u'date': u'2013-04-29T23:28:25Z', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: CSHARP-736: Don't cache EnsureIndex and deprecate CreateIndex.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/77bf751d0f16dba848ca2471f773785727b5d34e

Generated at Wed Feb 07 21:37:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.