Firebase Python firestore.DELETE_FIELD appears as an error in VS Code

Viewed 390

So I'm using the delete field method on documents in my Firestore database, and it seems to be working fine, but for some reason in VS Code it shows up as an error. I have it set up nearly identical to how they do it in their reference documents, except I'm deleting fields dynamically from a variable. Here's how my code looks:

db.collection("collection1").document(doc1).update({fieldValue: firestore.DELETE_FIELD})

Not sure why, but VS Code says firebase_admin.firestore has no "DELETE_FIELD" member, but the code still works as expected? Not a huge deal, but it's just annoying that my editor shows I have an error but it still works. Let me know if any of you have ran into this problem.

1 Answers

In case anyone else arrives here, DELETE_FIELD is an attribute of google.cloud.firestore_v1.transforms

So I solved it with:

from google.cloud.firestore_v1.transforms import DELETE_FIELD
db.collection("collection1").document(doc1).update({fieldValue: DELETE_FIELD})
Related