This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queryIterator = documentClient.queryDocuments(collection._self, query); | |
executeNextWithRetry(yourCallback); | |
function executeNextWithRetry(callback) { | |
queryIterator.executeNext(function(err, results, responseHeaders) { | |
if(err && err.code === 429 && responseHeaders['x-ms-retry-after-ms']) { | |
console.log("Retrying after " + responseHeaders['x-ms-retry-after-ms']); | |
setTimeout(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task InsertDocumentAsync(Student student, bool showDebugInfo) | |
{ | |
ResourceResponse<Document> response = await client.CreateDocumentAsync(colSelfLink, student); | |
Console.WriteLine("{0}\tInsert Operation, # of RUs: {1}", DateTime.UtcNow, response.RequestCharge); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if database exists, if not create it | |
Database database = client.CreateDatabaseQuery().Where(db => db.Id == id).ToArray().FirstOrDefault(); | |
if (database == null) | |
{ | |
database = await client.CreateDatabaseAsync(new Database { Id = id }); | |
} | |
// Get collection | |
StudentsCollection = client.CreateDocumentCollectionQuery(database.SelfLink).Where(c => c.Id == collectionId).ToArray().FirstOrDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.Documents; | |
namespace DocumentDBPerfScaleTest | |
{ | |
public class Student |
OlderNewer