Environment details
- OS: MacOS Sonoma V14.0
- .NET version: 7.0
- Package name and version: Google.Cloud.Firestore 3.4.0
Steps to reproduce
- If you explicitly set the precondition parameter to Precondition.MustExist in the UpdateAsync method:
await db
.Collection("path")
.Document("id")
.UpdateAsync("field", value, Precondition.MustExist, cancellationToken);
an exception is thrown
Cannot specify a must-exist precondition for update (Parameter 'precondition')
System.ArgumentException: Cannot specify a must-exist precondition for update (Parameter 'precondition')
at Google.Api.Gax.GaxPreconditions.CheckArgument(Boolean condition, String paramName, String message)
at Google.Cloud.Firestore.WriteBatch.Update(DocumentReference documentReference, IDictionary`2 updates, Precondition precondition)
at Google.Cloud.Firestore.DocumentReference.UpdateAsync(IDictionary`2 updates, Precondition precondition, CancellationToken cancellationToken)
However if you leave this as null which is equivalent to Must Exist ("May be null, which is equivalent to MustExist.") it works as expected.
Environment details
Steps to reproduce
an exception is thrown
However if you leave this as null which is equivalent to Must Exist ("May be null, which is equivalent to MustExist.") it works as expected.