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

Remove function is not deleting the record from collection. #187

Open
RSPaul opened this issue Mar 8, 2021 · 3 comments
Open

Remove function is not deleting the record from collection. #187

RSPaul opened this issue Mar 8, 2021 · 3 comments

Comments

@RSPaul
Copy link

RSPaul commented Mar 8, 2021

collection.remove({ fieldName: name }, { justOne: false }, function ()

I am using above code to delete the document from the collection, it gives no error but when check the database the same record is still there.

Its just add the following attributes to that document. I need to completely remove this document from database

{"_id":227,"_uid":227,"_dt":1614923923248,"_a":"del"}

image

@sirber
Copy link

sirber commented Jun 17, 2021

If I do a findOne(query), it will get the first document, even if it has been deleted.

@reregaga
Copy link

reregaga commented Dec 3, 2024

@RSPaul use yourCollectionName.compactCollection() as mentioned in README:

tingodb/README.md

Lines 123 to 125 in 1b1c55c

#### Collection.compactCollection, Database.compactDatabase
From the initial release compactionation function was available internally. There were several requests to make this avilable through API and we did it. Please keep in mind that compactination is best called as the first operation with database. Using compactionation in the middle of work session is also possible, but all cursors obtained prior to that will be invalidated and will throw errors on data access.

collection.compactCollection(function (e,r){});

@sirber
Copy link

sirber commented Dec 6, 2024

compacting before every operation is not very efficient, versus find to skip deleted ones until a later on compaction.

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

No branches or pull requests

3 participants