blinkdb-js / blinkdb

🗃️ An in-memory JS database optimized for large scale storage on the frontend.
https://blinkdb.io
MIT License
119 stars 10 forks source link

value.some is not a function #34

Closed ericvida closed 11 months ago

ericvida commented 11 months ago

CleanShot 2023-11-30 at 21 36 03@2x

I'm getting an odd issue, where if I pass an object for the contain query {contain: 'bob'} it throws an error. If I make it an array as the error seems to suggest [ {contains: 'bob'}] for example, I don't get an error, but I don't get results.

I'm following the documentation formatting: CleanShot 2023-11-30 at 21 35 44@2x

I code in imba which compiles to vanilla js. Not sure if this has anything to do with it not being typescript. CleanShot 2023-11-30 at 21 35 14@2x

maradotwebp commented 11 months ago

Are you trying to retrieve all items in the database where their name string includes a substring bob?

The contains filter checks whether an array property contains a value (in my example, whether there are any entities in the db which have the value Big Nick in their string array property of nicknames), not whether a string property includes some substring, which I think is what you're trying to achieve here.

ericvida commented 11 months ago

Ahh. I see. I misread the docs. Is there a way to search for a substring in a string?

maradotwebp commented 11 months ago

Nope, at least no efficient way. You'd have to retrieve all documents.