I figured out that of course . and SPACE aren't allowed. Are there other forbidden characters ?
ASP.NET Core 3 MVC Application with MongoDBTo search a string with special characters in MongoDB document, you can use \. Here, we have special character $ in our string.
Database names and Collection names are case sensitive. You can always recreate the DB/Collection with the appropriate name. The Mongo Shell is a interactive JS interpreter.
Field names are strings. Documents have the following restrictions on field names: The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array.
The maximum BSON document size is 16 megabytes. The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth. To store documents larger than the maximum size, MongoDB provides the GridFS API.
You can use any (UTF8) character in the field name which aren't special (contains ".", or starts with "$").
https://jira.mongodb.org/browse/SERVER-3229
https://stackoverflow.com/a/7976235/311220
It's generally best to stick with lowercase alphanumeric with underscores though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With