public void Execute(DocumentClient client, CosmosDbCredential credentials) { string outputFileName = AskForOutputFileName(); IEnumerable <string> collectionsToFetch = AskForCollections(); FetchDataAndSaveToFile(client, credentials.DatabaseId, outputFileName, collectionsToFetch); }
public void Execute(DocumentClient client, CosmosDbCredential credentials) { if (credentials.IsReadonly) { throw new Exception("You cannot export data to readonly database"); } string inputFile = AskForInputFile(); string collectionName = AskForCollectionName(); CreateCollectionIfNotExist(client, credentials.DatabaseId, collectionName); JArray data = DeserializeFile(inputFile); InsertOrUpdateToDatabase(client, credentials.DatabaseId, collectionName, data); }