[CSHARP-833] Naming Collections Created: 30/Sep/13  Updated: 30/Sep/13  Resolved: 30/Sep/13

Status: Closed
Project: C# Driver
Component/s: Feature Request
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: ali khan Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: feature
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CSHARP-126 New GetCollection<T>() signature that... Closed

 Description   

It would be useful to have a mechanism for naming of the collection from RegisterClassMap.

So we could do this for example:
BsonClassMap.RegisterClassMap<Car>(cm =>

{ cm.AutoMap(); cm.CollectionName("cars") }

);;



 Comments   
Comment by ali khan [ 30/Sep/13 ]

Ah, I did search before putting this on here, but did not see that thread. Currently I am using the extension method approach.

Thanks

Comment by Craig Wilson [ 30/Sep/13 ]

Hi Ali,
This is duplicate of CSHARP-126. Currently, the Bson layer doesn't know anything about databases or collections; it is just a Bson layer which can be used outside of MongoDB. As such, adding something like this in wouldn't be good. We have explored other ways of doing this and this is being kept in mind as something many users have requested as we work on our next major version.
In the meantime, it is relatively trivial to write an extension method to do this. If you need help with an extension method, please pose back.

Thanks for your interest.

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