1

I would like to delete the object with id number 2 in this Firestore object. Is that possible?

{
    "provider": "foo",
    "data": [{
            "id": 1,
            "name": "John"
        },
        {
            "id": 2,
            "name": "Bob"
        }
    ]
}

1 Answer 1

2

I have come up with this although it may be inefficient:

let! existingDoc = collection
                            .Document("foo")
                            .GetSnapshotAsync()

let datalist = existingDoc.GetValue<List<DataRecord>>("data")

let filteredList = datalist.Where(fun x -> x.id <> "2").ToList()

collection
         .Document("foo")
         .UpdateAsync("data", filteredList)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.