为 Parse Server 设置 MongoDB 环境要求

Setting up MongoDB environment requirements for Parse Server

我有我的实例 运行 并且能够远程连接,但是我不知道在哪里将此参数设置为 false,因为它声明默认设置为 true:

failIndexKeyTooLong 

启动 mongodb 服务器时,您可以将此参数设置为 false :

mongod --setParameter failIndexKeyTooLong=false

我写了一篇文章来帮助您在您自己的服务器上设置 Parse-Server 及其所有依赖项: https://medium.com/@jcminarro/run-parse-server-on-your-own-server-using-digitalocean-b2a7d66e1205

设置 'failIndexKeyTooLong' 分为三个步骤:

  1. 您需要转到数据库实例的管理数据库的“工具”菜单项中的命令控制台。此命令仅适用于 admin 数据库,如下图所示:

  2. 在那里,从列表中选择任何命令,它将为您提供该命令的简短 JSON 文本。

  3. 把他们提供的命令擦掉(我选的是'ping')然后输入下面的JSON:

    { 
      "setParameter" : 1, 
      "failIndexKeyTooLong" : false
    }
    

    下面是一个可以提供帮助的示例:

请注意,如果您在 MongoLab 使用免费计划:如果您有免费计划,这将不起作用;它仅适用于付费计划。如果您有免费计划,您甚至看不到管理数据库。但是,我联系了 MongoLab,这是他们的建议:

Hello,

First of all, welcome to MongoLab. We'd be happy to help.

The failIndexKeyTooLong=false option is only necessary when your data include indexed values that exceed the maximum key value length of 1024 bytes. This only occurs when Parse auto-indexes certain collections, which can actually lead to incorrect query results. Parse has updated their migration guide to include a bit more information about this, here:

https://parse.com/docs/server/guide#database-why-do-i-need-to-set-failindexkeytoolong-false-

Chances are high that your migration will succeed without this parameter being set. Can you please give that a try? If for any reason it does fail, please let us know and we can help you on potential next steps.

Our Dedicated and Shared Cluster plans (https://mongolab.com/plans/pricing/) do provide the ability to toggle this option, but because our free Sandbox plans are running on shared server processes, with other Sandbox users, this parameter is not configurable.