Import Data
Imports documents from file to a game data.
Command
# local game data (windows)
Charon.exe DATA IMPORT --dataBase "c:\my app\gamedata.json" --schemas Character --input "c:\my app\characters.json" --inputFormat json --mode safeUpdate
# remote game data
Charon.exe DATA IMPORT --dataBase "https://charon.live/view/data/My_Game/develop/" --schemas Character --input "./characters.json" --inputFormat json --mode safeUpdate --credentials "<API-Key>"
Parameters
- --dataBase
Absolute or relative oath 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.
- --schemas
A list of types of documents (schemas) to import. By default all schemas EXCEPT metadata are imported.
Use space to separate multiple schemas.
You can use wildcards (*) at the beginning and end of names.
You can use identifiers in {} instead of names.
You can exclude certain names by using an exclamation mark (!) at the beginning of their names.
# schema name --schemas Character --schemas Character Item # all (default) --schemas * # masks --schemas Char* --schemas *Modifier --schemas *Mod* # schema id --schemas {18d4bf318f3c49688087dbed} # negation --schemas Char* !Character --schemas !*Item*
- --mode
Import mode controls merge behavior during import.
# (default) --mode createAndUpdate --mode create --mode update --mode safeUpdate --mode replace --mode delete
- createAndUpdate
creates new documents and updates existing ones
- create
only creates new documents, existing documents are kept unchanged
- update
only updates existing documents, no new ones are created
- safeUpdate
same as update but without creating, moving and erasing embedded documents
- replace
replaces the entire collection with the imported documents
- delete
deletes documents found in the imported data
- --input
Path to a data file. Alternatively, you can use Standart Input or URL.
# standart input (default) --input in --input con # absolute path (windows) --input "c:\my app\characters.json" # absolute path (unix) --input "/user/data/characters.json" # relative path (universal) --input "./characters.json" # remote location (HTTP) --input "http://example.com/characters.json" # remote location with authentication (FTP) --input "ftp://user:password@example.com/characters.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 # XLSX Spreadsheet --inputFormat xlsx
- --inputFormattingOptions
Additional options for specified format.
- --dryRun
Allows you to run the command without actually making any changes to the game data, providing a preview of what would happen.
This command supports universal parameters.
Input Data Structure
The data you input should follow this structure (recommended):
{ "Collections": { "<Schema-Name>": [ { // <Document> } ] } }
This structure is also accepted:
{ "<Schema-Name>": [ { // <Document> } ] }
A list of documents is accepted if only one name in --schemas
is specified:
[ { // <Document> } ]
And single document is accepted too if only one name in --schemas
is specified:
{ // <Document> }