blinkdb-js/blinkdb

value.some is not a function

ericvida opened this issue · 3 comments

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

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.

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

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