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

IN operator is not working with @rids list #246

Closed
nomi-ramzan opened this issue Apr 22, 2017 · 2 comments
Closed

IN operator is not working with @rids list #246

nomi-ramzan opened this issue Apr 22, 2017 · 2 comments
Assignees
Labels

Comments

@nomi-ramzan
Copy link

Hi I am trying to run this query using orientjs

SELECT * FROM items WHERE link_id IN ['#12:1','#12:2','#12:3']`

I am getting empty result But when I am removing quotes from array

SELECT * FROM items WHERE link_id IN [ #12:1, #12:2, #12:3 ]

Then its working fine.

Here is my code

db.select().from('items')
  .where('link_id IN [:param0,:param1,:param2]')
  .addParams({ param0: '#12:1', param1: '#12:2', param2: '#12:3' })
  .all().then(console.log, console.log)

I also checked orientjs is sending these ides with quotes.
How can I solve this problem ?
Thank you

@wolf4ood
Copy link
Member

hi @nomi-ramzan

record ids are not strings, that is why that query is not working. In order to use Record ids with params you can use RecordId object.

const RID = require('orientjs').RID;
...

db.select().from('items')
  .where('link_id IN [:param0,:param1,:param2]')
  .addParams({ param0: new RID('#12:1'), param1: new RID('#12:2'), param2: new RID('#12:3') })
  .all().then(console.log, console.log)

Let me know if it helps you
Thanks

@wolf4ood wolf4ood self-assigned this Apr 26, 2017
@nomi-ramzan
Copy link
Author

@maggiolo00 Thank you. I will inform you if i will face any problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants