Determines whether or not the given field path is present in the document. If this snapshot represents
a missing document, this method will always return false.
true if the specified path represents a field in the document; false otherwise
ContainsField(string)
public bool ContainsField(string path)
Determines whether or not the given field path is present in the document. If this snapshot represents
a missing document, this method will always return false.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eDocumentSnapshot\u003c/code\u003e class in the Firestore API is 3.10.0, with older versions ranging from 3.9.0 down to 2.3.1 also documented.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDocumentSnapshot\u003c/code\u003e is an immutable class representing a snapshot of a document's data within a Firestore database, implementing the \u003ccode\u003eIEquatable\u003c/code\u003e interface.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides properties such as \u003ccode\u003eCreateTime\u003c/code\u003e, \u003ccode\u003eDatabase\u003c/code\u003e, \u003ccode\u003eExists\u003c/code\u003e, \u003ccode\u003eId\u003c/code\u003e, \u003ccode\u003eReadTime\u003c/code\u003e, \u003ccode\u003eReference\u003c/code\u003e, and \u003ccode\u003eUpdateTime\u003c/code\u003e to access document-specific information.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003eContainsField\u003c/code\u003e, \u003ccode\u003eConvertTo<T>\u003c/code\u003e, \u003ccode\u003eGetValue<T>\u003c/code\u003e, \u003ccode\u003eToDictionary\u003c/code\u003e, and \u003ccode\u003eTryGetValue<T>\u003c/code\u003e are available for data handling, including checking for field presence, deserializing, and fetching field values.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDocumentSnapshot\u003c/code\u003e can be used to access document's metadata and its data, handling whether or not a document exists, and managing the field's values, or retrieving the entire documents as a dictionary.\u003c/p\u003e\n"]]],[],null,["# Firestore API - Class DocumentSnapshot (3.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.10.0 (latest)](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.9.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.8.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.7.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.6.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.5.1](/dotnet/docs/reference/Google.Cloud.Firestore/3.5.1/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.4.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.3.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.2.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.1.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.0.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.5.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.4.0/Google.Cloud.Firestore.DocumentSnapshot)\n- [2.3.1](/dotnet/docs/reference/Google.Cloud.Firestore/2.3.1/Google.Cloud.Firestore.DocumentSnapshot) \n\n public sealed class DocumentSnapshot : IEquatable\u003cDocumentSnapshot\u003e\n\nReference documentation and code samples for the Firestore API class DocumentSnapshot.\n\nAn immutable snapshot of the data for a document. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e DocumentSnapshot \n\nImplements\n----------\n\n[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[DocumentSnapshot](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot) \n\nInherited Members\n-----------------\n\n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Firestore](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)\n\nAssembly\n--------\n\nGoogle.Cloud.Firestore.dll\n\nProperties\n----------\n\n### CreateTime\n\n public Timestamp? CreateTime { get; }\n\nThe creation time of the document if it exists, or null otherwise.\n\n### Database\n\n public FirestoreDb Database { get; }\n\nThe database that owns the document.\n\n### Exists\n\n public bool Exists { get; }\n\nWhether or not the document exists.\n\n### Id\n\n public string Id { get; }\n\nThe ID of the document.\n\n### ReadTime\n\n public Timestamp ReadTime { get; }\n\nThe time at which this snapshot was read.\n\n### Reference\n\n public DocumentReference Reference { get; }\n\nThe full reference to the document.\n\n### UpdateTime\n\n public Timestamp? UpdateTime { get; }\n\nThe update time of the document if it exists, or null otherwise.\n\nMethods\n-------\n\n### ContainsField(FieldPath)\n\n public bool ContainsField(FieldPath path)\n\nDetermines whether or not the given field path is present in the document. If this snapshot represents\na missing document, this method will always return false.\n\n### ContainsField(string)\n\n public bool ContainsField(string path)\n\nDetermines whether or not the given field path is present in the document. If this snapshot represents\na missing document, this method will always return false.\n\n### ConvertTo\\\u003cT\\\u003e()\n\n public T ConvertTo\u003cT\u003e()\n\nDeserializes the document data as the specified type.\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### GetValue\\\u003cT\\\u003e(FieldPath)\n\n public T GetValue\u003cT\u003e(FieldPath path)\n\nFetches a field value from the document, throwing an exception if the field does not exist.\n\n### GetValue\\\u003cT\\\u003e(string)\n\n public T GetValue\u003cT\u003e(string path)\n\nFetches a field value from the document, throwing an exception if the field does not exist.\n\n### ToDictionary()\n\n public Dictionary\u003cstring, object\u003e ToDictionary()\n\nReturns the document data as a [Dictionary\\\u003cTKey, TValue\\\u003e](https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2).\n\n### TryGetValue\\\u003cT\\\u003e(FieldPath, out T)\n\n public bool TryGetValue\u003cT\u003e(FieldPath path, out T value)\n\nAttempts to fetch the given field path from the document, returning whether or not it was found, and deserializing\nit if it was found.\n\n**Remarks** \nThis method does not throw an exception if the field is not found, but does throw an exception if the field was found\nbut cannot be deserialized.\n\n### TryGetValue\\\u003cT\\\u003e(string, out T)\n\n public bool TryGetValue\u003cT\u003e(string path, out T value)\n\nAttempts to fetch the given field path from the document, returning whether or not it was found, and deserializing\nit if it was found.\n\n**Remarks** \nThis method does not throw an exception if the field is not found, but does throw an exception if the field was found\nbut cannot be deserialized."]]