How to do an OR query on multiple fields? #192
-
Hi, im trying to do a search that can consider multiple fields but not clear on how to do this for example const searchPhrases = "John Doe".split(' '); // ['John', 'Doe']
const userMatches = db.users.findMany({
where: {
firstName: {
contains: searchPhrases, // check if firstName contains one of the values
},
lastName: {
contains: searchPhrases, // check if lastName contains one of the values
},
},
}) Will this search in firstName or lastName. OR will this do an is this currently possible? or Should i create a computed field to do searches on? |
Beta Was this translation helpful? Give feedback.
Answered by
kettanaito
Feb 22, 2022
Replies: 1 comment
-
Hey, @lwhiteley. The example above will do an The |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lwhiteley
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, @lwhiteley.
The example above will do an
AND
query, where all conditions must be met by individual data entry in order for it to pass.The
OR
queries are currently not supported. You can track its support status and contribute to their implementation/discussion in this issue: #89.