After some issues with HR Assistant I was thinking it would be a good idea to create a separate database with only the Design documents as schema database.
So I replicated all the documents from the original database to a brand new one and called it hrassistant_schema. After the successful replication I kept all only the design documents.
Today I got a question about the schemas and discovered it should also be a good idea to add all the configuration documents to the schema database of HR Assistant
In that case I have a basic set up and can use it all the time to generate a new instance of the database.
Prepare the JSON
In a Cloudant database it easy to get all the documents in JSON format from a certain view via the build in REST API. In my case I needed the configurations view JSON.
The documentation of Cloudant helped me to prepare the JSON to a certain format to remove everything before the doc entry and the } add the end of each document entry in the JSON. Include all the entries in array and assign it to docs keyword.
Insert the JSON in Cloudant
Using Postman on my MacBook to post the JSON directly into the Cloudant database. You need the url to the database on Cloudant and add to the url ‘/_bulk_docs’
At the authorization, select Basic Authentication and add your username and password.
In the Request body you add the prepared JSON and press post. In the Response body you get feedback of the operation. In my case all the documents, 24, are inserted successfull.
Meanwhile in Cloudant
When I checked the configuration view in the hrassistant_schema database I see all the new documents.
Happy coding and come to see me at my session at Engage on 9:00 Tuesday 9th of May, where I will show more technical details about the development of HR Assistant.