private static void validateAsMongoDBCollectionName ( String collectionName ) { Contracts . assertStringParameterNotEmpty ( collectionName , "requestedName" ) ; //Yes it has some strange requirements. if ( collectionName . startsWith ( "system." ) ) { throw log . collectionNameHasInvalidSystemPrefix ( collectionName ) ; } else if ( collectionName . contains ( "\u0000" ) ) { throw log . collectionNameContainsNULCharacter ( collectionName ) ; } else if ( collectionName . contains ( "$" ) ) { throw log . collectionNameContainsDollarCharacter ( collectionName ) ; } }
Validates a String to be a valid name to be used in MongoDB for a collection name .