0

From the console this is as easy as running the command:

db.<collectionName>.remove();

This does not appear to be implemented as part of the .NET driver functionality. How can I produce similar functionality within a .NET\C# program? I have a staging collection that I want to remove all records from after processing

1 Answer 1

1

Use RemoveAll to remove all records from a collection:

db.GetCollection("test").RemoveAll();
Sign up to request clarification or add additional context in comments.

2 Comments

Wow, that easy. I now feel bad about myself for not being able to figure that out, but thank you very much for the help. Is this something you knew already or am I not as good at Google searching for the documentation as I thought I was?
@TechDawg270 I just used Intellisense on the collection object; figured it probably started with 'remove' and there it was.

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.