Search code examples
mapr

Querying MapR with db-shell - where clause


The following works:

mapr dbshell 'find /sourcepath --q {"$select":"source","$where":{"$and":[{"$eq":{"status":"file_LOAD_START"}}]}}'

The following works too:

mapr dbshell 'find /sourcepath --q {"$select":"source","$where":{"$and":[{"$eq":{"car_id":"number"}}]}}'

But the following does not work

mapr dbshell 'find /sourcepath --q {"$select":"source","$where":{"$and":[{"$eq":{"status":"file_LOAD_START"}}, {"$eq":{"car_id":"number"}}]}}'

The error message states

"You cannot specify '{"$eq":{"car_id":"number"}}]}}' as another value for the default ('') option in a single command. You already provided '/sourcepath' earlier. Did you forget to add quotes around the value of another option?"


Solution

  • The reason why it did not work where white spaces.

    Removing the whitespace between {"status":"file_LOAD_START"}}, and {"$eq":{"car_id":"number"}}]}}' solved the problem