remorses / mongoke

https://mongoke.now.sh/docs/
216 stars 12 forks source link

And operator returns empty query #9

Open jmorakuebler opened 4 years ago

jmorakuebler commented 4 years ago

Hello everyone, I've been trying to query the database using multiple fields, but the data always returns empty. I already made sure the records meets the conditions separately, but when I use the and: operator, I returns empty. I also check the condition in the mongo shell. If anyone can give me a hand with this, I will appreciate it.

This returns records

query {
  TransaccionalNodes(where: {state: {eq: "3"}}){
    nodes {
      _id
      agente_id
      state
    }
  }
}

# result
{
  "data": {
    "TransaccionalNodes": {
      "nodes": [
        {
          "_id": "5edec4e584c4bffa20a64abb",
          "agente_id": "52",
          "state": "3"
        },
        {
          "_id": "5edec3e984c4bffa20a64aba",
          "agente_id": "52",
          "state": "3"
        },
        {
          "_id": "5edec2f484c4bffa20a64ab9",
          "agente_id": "52",
          "state": "3"
        }
      ]
    }
  }
}

This doesn't

query {
  TransaccionalNodes(where: {and: [{state: {eq: "3"}}, {agente_id: {eq: "52"}}]}){
    nodes {
      _id
      agente_id
      state
    }
  }
}

# result
{
  "data": {
    "TransaccionalNodes": {
      "nodes": []
    }
  }
}
remorses commented 4 years ago

Thank you for opening an issue, currently I am reimplementing the engine in golang, I will add your query as a test case to make sure it works