I am new to RavenDB and have been trying various things.
As RavenDB is a (json)document database, why does it not have a simple bulk JSON import option?
The web GUI has various data import options, including csv but no JSON.
I have searched for examples to utilize the REST API to bulk load a file with JSON documents. It seems to be a valid option but the import format requires that multiple 'PUT's be inserted into the file, and each document put must already have an 'ID' specified in it. How can this be done for many docs?
In the documentation the example given is:
curl -X POST "http://live-test.ravendb.net/databases/Example/bulk_docs"
-H "Content-Type: application/json"
-d "{
\"Commands\": [
{
\"Id\": \"person/1\",
\"ChangeVector\": null,
\"Document\": {
\"Name\": \"John Smith\"
},
\"Type\": \"PUT\"
},
{
\"Id\": \"person/1\",
\"ChangeVector\": null,
\"Patch\": {
\"Script\": \"this.Name = 'Jane Doe';\",
\"Values\": {}
},
\"Type\": \"PATCH\"
}
]
}"
([https://ravendb.net/docs/article-page/5.1/csharp/client-api/rest-api/document-commands/batch-commands])1
Surely there is a simpler way of doing this.
I have tried converting my JSON docs into a csv file and importing that but the file structure is not imported correctly back into the original JSON doc format.
Also, in the above example, which collection will these documents be loaded into?