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 (findMany, findFirst) ignores Array type fields. #249

Open
zorgick opened this issue Nov 15, 2022 · 0 comments
Open

Query (findMany, findFirst) ignores Array type fields. #249

zorgick opened this issue Nov 15, 2022 · 0 comments

Comments

@zorgick
Copy link

zorgick commented Nov 15, 2022

It seems like models, that have a field with an Array type, cannot be queried.

A simple model, where roles field is an array of numbers:

const db = factory({
  user: {
    id: primaryKey(() => faker.datatype.uuid()),
    name: () => faker.name.fullName(),
    age: () => faker.datatype.number(),
    roles: () => faker.helpers.arrayElements([1, 2, 3, 4])
  }
});

is ignored by findMany query:

const usersRoleSubset = db.user.findMany({
  where: {
    roles: {
      // no matter, which query (notIn, between) to use arrays are ignored
      in: [2, 3]
    }
  }
});

A reproducable example can be found here: https://codesandbox.io/s/flamboyant-shadow-rmb5gk?file=/src/index.js

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