Reputation: 179
I have a list of Ids that need to be deleted. I'm getting my collection from the database and passing it a resource. From which I want to iterate through the collection and delete a list of Ids being passed.
Before I was deleting records with a filter but I no longer need to search for Id as I am now passing a list of Ids.
public Task<DataRetentionOperationResult>
DeleteIdentifiedDataAsync(List<String> Ids, String Resource,
CancellationToken cancellationToken = default)
{
var collection = _db.GetCollection<BsonDocument>(Resource);
foreach (var id in Ids)
{
collection.DeleteManyAsync<BsonDocument>(id, cancellationToken);
}
throw new NotImplementedException();
}
I expect for the documents associated with the Ids passed to be deleted.
Upvotes: 0
Views: 368