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

whitelist $and operator problems #406

Closed
anyban opened this issue May 15, 2021 · 0 comments
Closed

whitelist $and operator problems #406

anyban opened this issue May 15, 2021 · 0 comments

Comments

@anyban
Copy link

anyban commented May 15, 2021

i'm use feathersjs-beta-1 and lastest feathersjs-mongoose lib

i'm try this query https://mongoplayground.net/p/qAZNZzEunRK
in service was added operator $and


  const options = {
    Model: createModel(app),
    // paginate: app.get('paginate'),
    paginate: false,
    whitelist: ['$and', '$elemMatch']
  }

  // Initialize our service with any options it requires
  app.use('/messages', new Messages(options, app))

after try

          .find({
            query: {
              $and: {
                users: [idA, idB],
              },
              $sort: {
                createdAt: 1,
              },
            },
          })

and what i have

Cast to Array failed for value "{ users: [ { users: '6093d388141d080c7fe0e3ca' }, { users: '6094512825b05e0cad9d6936' } ] }" at path "$and" for model "messages"

or


            query: {
              users: {
                $and: [userId, res._id],
              },
              $sort: {
                createdAt: 1,
              },

unknown operator: $and

@anyban anyban closed this as completed May 15, 2021
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