【问题标题】:Restheart add an new document in an shard collectionRestheart 在分片集合中添加新文档
【发布时间】:2018-11-09 17:40:38
【问题描述】:

我想在 mongodb 现有集合中添加一个新文档。但是这个集合是一个分片集合。我的分片键是_id。

发布http://ip:8080/db/coll

{"CODE_LOG":260,"Date": {"$date" : "2015-10-27T18:21:37.55Z" }}

我收到此错误:

{"http status code":400,"http status description":"Bad Request","message":"Write request for sharded collection must specify the shardkey. Use the 'shardkey' query parameter."}

我不想指定 shardkey 的值。

【问题讨论】:

    标签: restheart


    【解决方案1】:

    错误(代码 61)来自 MongoDB。 RESTHeart 只是管理它并返回您报告的错误消息,响应状态代码为 400 BAD REQUEST。

    查看错误代码here

    error_code("ShardKeyNotFound", 61)

    但是关于 shardkey 的 restheart 文档页面报告

    当共享集合的分片键不同于 _id 或复合分片键时,必须使用 shardkey 查询参数。

    您应该检查您的配置并确保分片键实际上只是 _id。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-19
      • 1970-01-01
      • 1970-01-01
      • 2018-08-06
      • 2023-02-11
      相关资源
      最近更新 更多