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

Query inside jsonb #527

Open
MichaelBitard opened this issue Oct 4, 2022 · 0 comments
Open

Query inside jsonb #527

MichaelBitard opened this issue Oct 4, 2022 · 0 comments

Comments

@MichaelBitard
Copy link

MichaelBitard commented Oct 4, 2022

Hello,

I can't find anything in the documentation, so I was wondering if it was possible or not.

Let's say I have a table :

interface JsonBContent {
  data?: { [key in 'one' | 'two']?: number }
}

const tableWithJsonB = defineTable({
  id: text().notNull(),
  annee: text(),
  content: jsonb<JsonBContent>()
})

I'd like to query this data given the presence of the key 'one' in the row.
In full sql I can do it like that :

select * from tableWithJsonB
where tableWithJsonB.contenu -> 'data' ? 'one'

But I can't find a way to do that with mammoth. Is there something I am missing?

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

No branches or pull requests

1 participant