Skip to content

ObjectId cannot be used on equals step for Atlas Search #5543

Closed Answered by alexbevi
ppascualv asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ppascualv, the issue you appear to be facing is the pipeline being sent to the server that will be used by Atlas Search contains an invalid value type ("compound.filter[0].equals.value" must be a boolean, objectId, number, or date).

Instead of trying to convert current_user.account_id to EJSON, just let the driver serialize the value as needed.

Try the following and let us know if it works:

  def filter_stage
    [
      {
        equals: {
          path: 'account_id',
          value: current_user.account_id
        }
      }
    ]
  end

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ppascualv
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