The constructor of SimpleMongoDbFactory implements a constraint for the MongoDB database name.
This constraint is not consistent with the MongoDB documentation. In "MongoDB The Definitive Guide" page 9 states:Code:private SimpleMongoDbFactory(Mongo mongo, String databaseName, UserCredentials credentials, boolean mongoInstanceCreated) { ... Assert.isTrue(databaseName.matches("[\\w-]+"), "Database name must only contain letters, numbers, underscores and dashes!");
In our environment we are using database names that contain characters # and : as well, e.g. maphub:tst#tst#Test. This naming scheme cannot be implemented with spring-data-mongodb, but is allowed in MongoDB. Is there a way to circumvent the restriction in SimpleMongoDbFactory?Database names can be any UTF-8 string, with the following restrictions:
• The empty string ("") is not a valid database name.
• A database name cannot contain any of these characters: ' ' (a single space), ., $, /, \, or \0 (the null character).
• Database names should be all lowercase.
• Database names are limited to a maximum of 64 bytes.
Thanks in advance,
Lars


Reply With Quote
