cursusdb / cursusdb

CursusDB is an open-source distributed in-memory yet persisted document oriented database system with real time capabilities.

Home Page:https://cursusdb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is that returned collection legit?

Fabrice-ops opened this issue · comments

Hello. Playing around with CursusDB, I went though this. I may be totally dumb but it seems the last query should only return the second document (the one with last == 'Lee').

cursusdb

@Fabrice-ops I see what ya did there.

select * from users where name == '' OR name != EMPTY AND last == 'LEE';

Makes sense you said give me users with the name that's empty OR
a name that is not empty with a last name of lee. I see it gave you back 2 results. Hm what version is that?

Ok I've been able to reproduce @Fabrice-ops . I am seeing what it is currently. I will post back shortly.

select * from users where name != '' && last = 'Lee'; #1
Works good, gets 1 document

select * from users where name == '' || name != '' || last = 'Lee'; #2
Works good gets 2 documents

select * from users where name == '' || name != '' && last = 'Lee'; #3
This gets 2 documents. Which I think is correct.

Look at this:
Screenshot from 2024-01-14 13-36-43
#4

See how it gets 1 document? So basically what you wrote there
image

Both your conditions are true!! Thus you get both documents.

@Fabrice-ops

With above comment of mine my testing has proven the system is working as expected.

Nope. The document describing Alex Padula uses key "lastName" not "last". Only the document describing Alex Lee uses key "last". Therefore your example #1 and #2 are OK, but #3 is NOK. Because name != '' && last = 'Lee' should only select the document describing Alex Lee.
Even if both documents used the key 'last' it should only select the document describing Alex Lee because values 'Lee' and 'Padula' are diff.
#4 is NOK, name ='b' && last ='Lee' should return nothing, as the document for Alex Lee name value is "Alex" not 'b'.
By the way, the version is the one I got cloning the git [946a20f] and the data for documents as following the doc on github too.
Overall, CursusDB is great. I plane to do more with it, will let you know :)

@Fabrice-ops from what I've gathered this will happen if the second document doesn't contain a "last" key to compare to so the AND is just comparing to the name key and last key. You get what i'm sayin :P So the conditions still passed for both documents because the other key doesn't exist. Does that not logically make sense? I think it does, I may be wrong. Let me know, i appreciate it, everything!

Thank you. Yes I got that, but seems to me that if the second key does not exist it should not return docs not having this second key because AND then should not be satisfied. I will zoom out for now then zoom in again later so I can further reflect about it. :)

I could implement that!