{
  "id": "mongoimport",
  "name": "mongoimport",
  "description": "Import data from a JSON, CSV, or TSV file into a MongoDB instance.",
  "homepage": "https://www.mongodb.com/docs/database-tools/mongoimport/",
  "executables": [
    "mongoimport"
  ],
  "commands": {
    "format": 1,
    "label": "Import data",
    "description": "Import a JSON, CSV or TSV file into a collection. Credentials, TLS and Kerberos options are left out; put credentials in a connection URI or config file instead.",
    "quality": "ai-draft",
    "base": "fig:mongoimport",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": true,
      "short_bundles": false
    },
    "source": [
      {
        "id": "fig",
        "kind": "completion",
        "url": "https://github.com/withfig/autocomplete/blob/master/src/mongoimport.ts",
        "license": "MIT"
      }
    ],
    "field": [
      {
        "id": "uri",
        "label": "Connection URI",
        "type": "string",
        "option": [
          "--uri"
        ],
        "suggestions": [
          {
            "value": "mongodb://localhost:27017",
            "label": "Local"
          }
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "host",
        "label": "Host",
        "type": "string",
        "option": [
          "--host"
        ],
        "suggestions": [
          {
            "value": "localhost:27017",
            "label": "localhost:27017"
          }
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "db",
        "label": "Database",
        "type": "string",
        "option": [
          "--db",
          "-d"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "collection",
        "label": "Collection",
        "type": "string",
        "option": [
          "--collection",
          "-c"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "file",
        "label": "Input file",
        "type": "path",
        "option": [
          "--file"
        ],
        "path": {
          "kind": "file",
          "role": "input"
        },
        "sources": [
          "fig"
        ]
      },
      {
        "id": "type",
        "label": "File type",
        "type": "string",
        "option": [
          "--type"
        ],
        "suggestions": [
          {
            "value": "json",
            "label": "JSON"
          },
          {
            "value": "csv",
            "label": "CSV"
          },
          {
            "value": "tsv",
            "label": "TSV"
          }
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "headerline",
        "label": "First line is header",
        "type": "boolean",
        "option": [
          "--headerline"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "fields",
        "label": "Field names",
        "description": "Comma-separated, for CSV/TSV files without a header line.",
        "type": "string",
        "option": [
          "--fields",
          "-f"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "mode",
        "label": "Import mode",
        "description": "How to handle existing documents that match.",
        "type": "string",
        "option": [
          "--mode"
        ],
        "suggestions": [
          {
            "value": "insert",
            "label": "Insert"
          },
          {
            "value": "upsert",
            "label": "Upsert"
          },
          {
            "value": "merge",
            "label": "Merge"
          },
          {
            "value": "delete",
            "label": "Delete"
          }
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "upsert_fields",
        "label": "Upsert fields",
        "type": "string",
        "option": [
          "--upsertFields"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "drop",
        "label": "Drop collection first",
        "description": "Drops the target collection before importing.",
        "type": "boolean",
        "option": [
          "--drop"
        ],
        "effect": "delete",
        "sources": [
          "fig"
        ]
      },
      {
        "id": "stop_on_error",
        "label": "Stop on first error",
        "type": "boolean",
        "option": [
          "--stopOnError"
        ],
        "sources": [
          "fig"
        ]
      }
    ],
    "task": [
      {
        "id": "import-csv",
        "label": "Import a CSV with header",
        "fields": [
          "uri",
          "db",
          "collection",
          "file",
          "type",
          "headerline"
        ],
        "set": {
          "type": [
            "csv"
          ],
          "headerline": [
            true
          ]
        },
        "required": [
          "db",
          "collection",
          "file"
        ]
      },
      {
        "id": "import-json",
        "label": "Import a JSON file",
        "fields": [
          "uri",
          "db",
          "collection",
          "file",
          "mode",
          "drop"
        ],
        "required": [
          "db",
          "collection",
          "file"
        ]
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "uri",
          "host",
          "db",
          "collection",
          "file",
          "type"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "headerline",
          "fields",
          "mode",
          "upsert_fields",
          "drop",
          "stop_on_error"
        ]
      }
    ]
  }
}
