database/collection name limitation

1,001 views
Skip to first unread message

Valentin Kuznetsov

unread,
Jan 4, 2011, 11:07:00 AM1/4/11
to mongodb-user
Does MongoDB impose any constrains on database/collection name length?

Robert Stam

unread,
Jan 4, 2011, 11:13:34 AM1/4/11
to mongodb-user
Yes.

Database names:

- empty string is not valid
- cannot contain space, ".", "$", "/", "\\" or "\0"
- should be all lowercase
- limited to 64 bytes (after conversion to UTF-8)
- admin, local and config are reserved

Collection names:

- empty string is not valid
- cannot contain "\0"
- avoid creating any collections with "system." prefix
- user created collections should not contain "$" in the name

Also, the sum of the database name + collection name + 1 is limited to
121 bytes (in practice stay below 100).
Reply all
Reply to author
Forward
0 new messages