[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: |
|
||||||||||||
| 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: |