需要将 JSON 的 2M 导入到一个 Couchbase 文档中

Need to import 2M of JSON into ONE Couchbase Document

有人要求我将 Excel 电子表格存储在 Couchbase 中的一个 JSON 文档中。 cbimport 说我的文档无效 JSON,但实际上是这样,所以我认为还有其他问题。

我的文档遵循这样的风格:

[{ "sets": [
   {
      "cluster" : "M1M",
      "type" : "SET",
      "shortName" : "MARTIN MARIETTA MATERIALS",
      "clusterName" : "MARTIN MARIETTA",
      "setNum" : "10000163"
   },
   {
      "shortName" : "STERLING INC",
      "type" : "SET",
      "cluster" : "SJW",
      "setNum" : "10001427",
      "clusterName" : "STERLING JEWELERS"
   },
   ...
]}]

我的 cbimport 命令如下所示:

cbimport json --cluster localhost --bucket documentBucket \
--dataset file://set_numbers.json --username Administrator \
--password password --format lines -e errors.log -l debug.log \
--generate-key 1

我尝试将格式设置为 lines 以及 list。两者都失败了。我做错了什么?

我将您的示例写入了一个名为 set_numbers.json 的 json 文件,并在本地使用列表进行了尝试。

cbimport json --cluster localhost --bucket documentBucket --dataset file://set_numbers.json --username Administrator --password password --format list --generate-key 1

导入单个文档成功

使用cbimport上传json数据

cbimport json -c couchbase://127.0.0.1 -b data -d file://data.json -u Administrator -p password -f list -g "%id%" -t 4