Skip to content

Instantly share code, notes, and snippets.

@ryanmats
Last active May 1, 2018 23:48
Show Gist options
  • Save ryanmats/66ea48d6838bcb587d5eba27a731a474 to your computer and use it in GitHub Desktop.
Save ryanmats/66ea48d6838bcb587d5eba27a731a474 to your computer and use it in GitHub Desktop.
AddData1 - Original
private static async Task AddData1(string project)
{
FirestoreDb db = FirestoreDb.Create(project);
// [START fs_add_data_1]
DocumentReference docRef = db.Collection("users").Document("alovelace");
Dictionary<string, object> user = new Dictionary<string, object>
{
{ "First", "Ada" },
{ "Last", "Lovelace" },
{ "Born", 1815 }
};
WriteResult writeResult = await docRef.SetAsync(user);
Console.WriteLine(writeResult.UpdateTime);
// [END fs_add_data_1]
Console.WriteLine("Added data to the alovelace document in the users collection.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment