Update Document

Updates a document. For a bulk updates use DATA IMPORT command with --mode update.
The update document in --input may be partial, with non-included fields being omitted.
Only the first document from the --input will be processed.

Command

# local game data (windows)
Charon.exe DATA UPDATE --dataBase "c:\my app\gamedata.json" --schema Item --input "c:\my app\item.json" --inputFormat json

# remote game data
Charon.exe DATA UPDATE --dataBase "https://charon.live/view/data/My_Game/develop/" --schema Item --input "./item.json" --inputFormat json --credentials "<API-Key>"

Parameters

--dataBase

Absolute or relative path to game data. Use quotation marks if your path contains spaces.

# local file
--dataBase "c:\my app\gamedata.json"

# remote server
--dataBase "https://charon.live/view/data/My_Game/develop/"
--credentials

The API key used to access remote server in case of –dataBase being URL.

--schema

Name or identifier of the type (schema) of updated document.

# name
--schema Item

# id
--schema 55a4f32faca22e191098f3d9
--id

Identifier of updated document. Could be omitted if Id is specified in --input document.

# text
--id Sword

# number
--id 101
--input

Path to a file with update data. Alternatively, you can use Standart Input or URL.

# standart input (default)
--input in
--input con

# absolute path (windows)
--input "c:\my app\item.json"

# absolute path (unix)
--input "/user/data/item.json"

# relative path (universal)
--input "./item.json"

# remote location (HTTP)
--input "http://example.com/item.json"

# remote location with authentication (FTP)
--input "ftp://user:password@example.com/item.json"
--inputFormat

Format of update data.

# Auto-detect by extension (default)
--inputFormat auto

# JSON
--inputFormat json

# BSON
--inputFormat bson

# Message Pack
--inputFormat msgpack

# XML
--inputFormat xml
--inputFormattingOptions

Additional options for specified format.

--output

Path to a updated document file. If the file exists, it will be overwritten. The directory must already exist. Alternatively, you can output to Standard Error, Standard Output, /dev/null, or a URL.

# standart output
--output out
--output con

# standart error
--output err

# null device (default)
--output null

# absolute path (windows)
--output "c:\my app\updated_item.json"

# absolute path (unix)
--output /user/data/updated_item.json

# relative path (universal)
--output "./updated_item.json"

# remote location (HTTP)
--output "http://example.com/updated_item.json"

# remote location with authentication (FTP)
--output "ftp://user:password@example.com/updated_item.json"
--outputFormat

Format of updated data.

# JSON (default)
--outputFormat json

# BSON
--outputFormat bson

# Message Pack
--outputFormat msgpack

# XML
--outputFormat xml
--outputFormattingOptions

Additional options for specified format.

This command supports universal parameters.

Input Data Schema

The data you input should follow this schema (recommended):

{
  "Collections": {
    "<Schema-Name>": [
      {
        // <Document>
      }
    ]
  }
}

This schema is also accepted:

{
  "<Schema-Name>": [
    {
      // <Document>
    }
  ]
}

A list of documents is accepted:

[
  {
    // <Document>
  }
]

And single document too:

{
  // <Document>
}