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

Cannot delete docs, unless tree is filled equal to order size #12

Closed
anuragvohraec opened this issue May 8, 2020 · 5 comments
Closed

Comments

@anuragvohraec
Copy link
Contributor

Hi Alex,

here is a test code:

const {SBTree} = require('sbtree');
const tree = new SBTree({order: 3});

(async()=>{
    await tree.insertDocuments({
        doc_id: '754aeea7c0919797d6eb2710d200eafd',
        key: 'VATEmq',
        value: 4,
        ts: 1588913801357
    })
    const t1 = new Date().getTime()-10000;
    console.log(t1, typeof t1);
    console.log(1588913801357<t1);
    console.log(await tree.deleteDocuments({ts: {$lte: t1}}))
})().then(v=>{
    console.log("Complete");
})

the delete documents returns null during deleting the document.
Unless I keep tree filled equal to order , this tree won't work.

@Alex-Werner
Copy link
Owner

Hey @anuragvohraec !
Thank you for this report !
There is multiples issues, the most obvious one, this should have been tracked by the test suite.
I will work on and fix that asap.

@anuragvohraec
Copy link
Contributor Author

anuragvohraec commented May 12, 2020

I will work on and fix that asap.

I tried fixing it, I added this line , it seems to solve the issue with above code.

img

@Alex-Werner
Copy link
Owner

That look nice ! Thank you !

If you want, you can directly edit the code via Github and propose a PR, then I will jump in it to cover test it and we will get that fixed in a new release, you can also let me do that :)

I might need to wait for this week-end to deal with that, I have urgent work to provide to my customer first, so worst case scenario should be next week a fix release, sorry for any delay.

@anuragvohraec
Copy link
Contributor Author

If you want, you can directly edit the code via Github and propose a PR, then I will jump in it to cover test it and we will get that fixed in a new release, you can also let me do that :)

I will do that.

I might need to wait for this week-end to deal with that, I have urgent work to provide to my customer first, so worst case scenario should be next week a fix release, sorry for any delay.

I can totally understand.

@Alex-Werner
Copy link
Owner

Fixed by #13 and #14

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

2 participants