Skip to content

Instantly share code, notes, and snippets.

@ryanmats
Created May 1, 2018 23:59
Show Gist options
  • Save ryanmats/84744aa4210d8317042ab24586e7ada4 to your computer and use it in GitHub Desktop.
Save ryanmats/84744aa4210d8317042ab24586e7ada4 to your computer and use it in GitHub Desktop.
AddData1 - New
private static async Task AddData1(string project, string usersCollectionId)
{
FirestoreDb db = FirestoreDb.Create(project);
// [START fs_add_data_1]
DocumentReference docRef = db.Collection(usersCollectionId).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