Skip to content

Error when using $and query #3317

Answered by ericuldall
ericuldall asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure if there's something I'm missing but in order to make my query work I had to add the following:

const listTypeFixes = Type.Optional(Type.Union([
  ObjectIdSchema(),
  Type.Array(ObjectIdSchema()),
  Type.Object({ $nin: Type.Array(ObjectIdSchema()) }),
]));
export const savedProductsQueryProperties = Type.Pick(savedProductsSchema, ['_id', '_shortId', 'userId', 'public', 'productId', 'createdAt', 'updatedAt'])
export const savedProductsQuerySchema = Type.Intersect(
  [
    querySyntax(savedProductsQueryProperties),
    // Add additional query properties here
    Type.Object({
      lists: listTypeFixes,
      $and: Type.Array(Type.Object({
        lists: listTypeFixes
      }))…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@daffl
Comment options

@ericuldall
Comment options

@ericuldall
Comment options

Comment options

You must be logged in to vote
2 replies
@daffl
Comment options

@ericuldall
Comment options

Answer selected by ericuldall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants