[CSHARP-428] Add new IsDatabaseNameValid and IsCollectionNameValid methods Created: 03/Apr/12 Updated: 02/Apr/15 Resolved: 04/Apr/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4 |
| Fix Version/s: | 1.4.1 |
| 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 | ||
| Description |
|
Some types of applications (like management UIs) have a need to test whether a given database or collection name is valid before actually trying to create a database or collection object. These methods allow testing a name without attempting to create a database or collection object. IsDatabaseNameValid will be an instance method of MongoServer in case at some point in the future the validity of a database name is a function of the operating system the server is running on or the version of the server. IsCollectionNameValid will be an instance method of MongoDatabase for similar reasons. |
| Comments |
| Comment by Roman Kuzmin [ 05/Apr/12 ] | ||||||||||||||
|
Please, take a look at this post: It seems to show a more effective (or is it just more concise?) way with `IndexOfAny()`. Also, at least on Windows, there are more troublesome names than one may expect: Perhaps, it makes sense to take this into account if the goal is to make it really bulletproof. In one of my applications I recently started to use this approach:
| ||||||||||||||
| Comment by ??? [ 05/Apr/12 ] | ||||||||||||||
|
Thank you. |