mongodb中有的特殊字符不能作为key,比如".",请问一下大家一共有多少种特殊字符不能作为key?
2条回答 默认 最新
- jinnianshilongnian 2012-12-11 14:46关注
请参考mongodb手册
[url]http://docs.mongodb.org/manual/reference/limits/#Restrictions%20on%20Field%20Names[/url]Naming Restrictions
Restrictions on Database Names
The dot (i.e. .) character is not permissible in database names.Database names are case sensitive even if the underlying file system is case insensitive.
Changed in version 2.2: For MongoDB instances running on Windows.
In 2.2 the following characters are not permissible in database names:
/. "*<>:|?
See Restrictions on Database Names for Windows for more information.Restriction on Collection Names
New in version 2.2.Collection names should begin with an underscore or a letter character, and cannot:
contain the $.
be an empty string (e.g. "").
contain the null character.
begin with the system. prefix. (Reserved for internal use.)
See Are there any restrictions on the names of Collections? and Restrictions on Collection Names for more information.Restrictions on Field Names
Field names cannot contain dots (i.e. .), dollar signs (i.e. $), or null characters. See Dollar Sign Operator Escaping for an alternate approach.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报