Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Unset a a property #2531

Open
ssteiner opened this issue Aug 7, 2024 · 2 comments
Open

[QUESTION] Unset a a property #2531

ssteiner opened this issue Aug 7, 2024 · 2 comments
Labels

Comments

@ssteiner
Copy link

ssteiner commented Aug 7, 2024

I'm implementing Migrations for LiteDb. In other NoSql Dbs, they have an unset command, which allows you to clear a property from a document (or a set of documents). Is there something similar with LiteDb?

I know I can load all documents from a collection, call BsonDocument.Remove(propertyName) to remove a property, then call collection.Update(doc) - but that requires loading every document. To add a property / set a property, I can use the collection.UpdateMany method with a BsonDocument containing the changes I want to make, so no need to load everything. Is there something like that to remove a property from a list of documents without having to load them all?

@JKamsker
Copy link
Collaborator

JKamsker commented Aug 8, 2024

I strongly believe that behind the scenes, every document is loaded when calling UpdateMany anyways.

@ssteiner
Copy link
Author

ssteiner commented Aug 8, 2024

Hmm... I guess I'll have a look. I already tried a local build yesterday when I couldn't run DropCollection with an active transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants