MongoDB case insensitive key search

北城以北 提交于 2019-12-01 17:40:14

There is currently no way to do this.

MongoDB is "schema-free" but that should not be confused with "doesn't have a schema". There's an implicit assumption that your code has some control over the names of the keys that actually appear in the system.

Let's flip the question around.

  • Is there a good reason that users are inserting case-sensitive keys?
  • Can you just cast all keys to lower-case when they're inserted?

Again, MongoDB assumes that you have some knowledge of the available keys. Your question implies that you have no knowledge of the available keys. You'll need to close this gap.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!