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

It does not support 'contains' keyword in findAll() query #10

Open
gutenye opened this issue Aug 28, 2015 · 8 comments
Open

It does not support 'contains' keyword in findAll() query #10

gutenye opened this issue Aug 28, 2015 · 8 comments

Comments

@gutenye
Copy link

gutenye commented Aug 28, 2015

I tried

User.findAll({where: {tags: {"contains": "a"}}}).then(..)

But got

error ReqlDriverError {message: "Annonymous function returned `undefined`. Did you forget a `return`?"}

It works in filter() though. So it seems that the adapter does not support "contains" keyword?

@jmdobry
Copy link
Member

jmdobry commented Aug 28, 2015

I guess the contains operator was added to jsdata, but not to the adapter.
On Aug 27, 2015 6:00 PM, "Guten Ye" [email protected] wrote:

I tried

User.findAll({tags: {"contains": "a"}}).then(..)

But got

error ReqlDriverError {message: "Annonymous function returned undefined. Did you forget a return?"}

It works in filter() though. So it seems the adapter does not support
"contains" keyword?


Reply to this email directly or view it on GitHub
#10.

@recipher
Copy link

recipher commented Sep 4, 2015

Is this the adapter? Does contains need to be added here, or elsewhere?

@jmdobry
Copy link
Member

jmdobry commented Sep 4, 2015

Needs to be added to the adapter.

@jmdobry
Copy link
Member

jmdobry commented Mar 18, 2016

Support for contains, |contains, notContains and |notContains has been added to 3.x alpha.

@mikew
Copy link

mikew commented Oct 6, 2016

Is there a test or example for how contains works or is there something I'm doing wrong here? I'm on [email protected], and trying to do something simple like ...

Survey.findAll({ where: { name: { contains: 'survey 2' } } })

... is giving a ReQL error:

ReqlLogicError: Cannot convert STRING to SEQUENCE in:
r.db("test").table("survey").filter(function(var_5) {
    return var_5("name").default([]).contains("survey 2")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
})

@jmdobry
Copy link
Member

jmdobry commented Oct 13, 2016

I believe contains is an Array operation, and doesn't work on strings. It only works on sequences: https://rethinkdb.com/api/javascript/#contains

@mikew
Copy link

mikew commented Oct 14, 2016

That was totally it. I've since migrated to version 3 and adapted like/notLike from #12 into it, can send a PR if you'd like

@jmdobry
Copy link
Member

jmdobry commented Oct 17, 2016

Yeah, I'd be interested at looking at your PR.

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

Successfully merging a pull request may close this issue.

4 participants