cat JSON_DOCNAME | dataset COLLECTION_NAME create KEY
dataset -i JSON_DOCNAME COLLECTION_NAME create KEY
dataset COLLECTION_NAME create KEY JSON_VALUE
dataset COLLECTION_NAME create KEY JSON_FILENAME
create adds or replaces a JSON document to a collection. The JSON document can be read from a standard in, a named file (with a “.json” file extension) or expressed literally on the command line.
In the following four examples jane-doe.json is a file on the local file system
contains JSON data containing the JSON_VALUE of {"name":"Jane Doe"}
. The KEY we will
create is r1. Collection is “people.ds”. The following are equivalent in resulting record.
cat jane-doe.json | dataset people.ds create r1
dataset -i blob.json people.ds create r1
dataset people.ds create r1 jane-doe.json
dataset people.ds create r1 '{"name":"Jane Doe"}'
Related topics: update, read, and delete