Create Document

Creates a new document. For a bulk creations use DATA IMPORT command with --mode create.
Only the first document from the --input will be processed.

Command

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

# remote game data
Charon.exe DATA CREATE --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 the new document.

# name
--schema Item

# id
--schema 55a4f32faca22e191098f3d9
--input

Path to a file with document. 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 imported 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 created 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\created_item.json"

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

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

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

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

Format of created 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>
}