解析服务器上的长 text/string

Long text/string on Parse server

我正在尝试在托管在 heroku 上的解析服务器实例上保存一个长 text/string。我正在通过 node-js 代码保存它。当然,mongodb被用作db。

该字符串是解析对象的一部分,当我尝试保存它时,我在 Parse 上收到一个没有帮助的错误:

ParseError { code: 1, message: undefined }

通过 Parse Dashboard 检查日志后,我看到:

Error generating response. { MongoError: Btree::insert: key too large to index, failing aaa.prod.$_p_productDescription_1 1034 { : "aaaLocation$jw5PnglCB1", : new Date(1494147063161), : "This is the text I'm trying to create in mongo blablablablalbalbalbalbalbalblablalbalalbalblablablalbalbalblalbalblab..." }
    at Function.MongoError.create (/app/node_modules/mongodb-core/lib/error.js:31:11)
    at toError (/app/node_modules/mongodb/lib/utils.js:139:22)
    at /app/node_modules/mongodb/lib/collection.js:739:67
    at /app/node_modules/mongodb-core/lib/connection/pool.js:461:18
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)
  name: 'MongoError',
  message: 'Btree::insert: key too large to index, failing aaa.prod.$_p_productDescription_1 1034 { : "aaaLocation$jw5PnglCB1", : new Date(1494147063161), : "This is the text I'm trying to create in mongo blablablablalbalbalbalbalbalblablalbalalbalblablablalbalbalblalbalblab..." }',
  driver: true,
  index: 0,
  code: 17280,
  errmsg: 'Btree::insert: key too large to index, failing

有没有办法通过 Parse 服务器在 mongo 中存储长文本?

也许我不应该用这样的实现来做这件事,但是有什么选择呢?

更新

当我尝试向其中存储长字符串时出现此错误的字段称为 "productDescription"。当我尝试将相同的长字符串存储到另一个名为 "title" 的字段时,它起作用了。不知道为什么会这样...

在mongodb中,如果要在键上创建索引,则键的大小必须小于1024 字节。

查看此 doc 了解更多详细信息和可能的解决方案。

弄清楚了,Astro 的回答得到了一些信任。 Mongo 自动索引查询我不得不删除涉及 "productDescription" 字段的索引。 "title" 字段能够存储非常长的文本,因为它从未被 mongo 索引。