[CSHARP-1529] MongoCollectionSettings.AssignIdOnInsert has no effect Created: 12/Jan/16 Updated: 21/Apr/16 Resolved: 14/Jan/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Operations |
| Affects Version/s: | 2.2, 2.2.1 |
| Fix Version/s: | 2.2.2 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Konstantin Zanev | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
According to the MongoDB documentation: "if the mongod receives a document to insert that does not contain an _id field, mongod will add the _id field that holds an ObjectId." Currently it is not possible to use this feautre of the mongod server, because the above mentioning option is not considered by the driver and ObjectId is always generated on collection insert. Note: Legacy versions of the driver still support this feature. |
| Comments |
| Comment by Githook User [ 14/Jan/16 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}Message: |
| Comment by Githook User [ 14/Jan/16 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}Message: |
| Comment by Konstantin Zanev [ 12/Jan/16 ] |
|
You're welcome. Thank you for your quick response. |
| Comment by Craig Wilson [ 12/Jan/16 ] |
|
Ok, I see the problem. The setting is still there, but it is getting ignored. We'll mark this to be fixed. Thanks for the report. Craig |
| Comment by Konstantin Zanev [ 12/Jan/16 ] |
|
Thank you Craig. Please refer to the scenario described by this Stackoverflow post: http://stackoverflow.com/questions/24723954/mongodb-c-sharp-driver-and-server-generated-objectids This was possible with 1.x, now it isn't. |
| Comment by Konstantin Zanev [ 12/Jan/16 ] |
|
Priority Major was not really attetened |
| Comment by Craig Wilson [ 12/Jan/16 ] |
|
Hi Konstantin, The driver, when it sees a document to be inserted without an identifer, will always generate the identifier client-side. This has been true for as long as I can remember from the legacy driver version up until now. Are you indicating that you'd wish the driver would not do this and let the server always generate the identifier? If so, could you please explain why? If not, then please restate your question/request as I have misunderstood. Thanks, |