Querying with HPE Ezmeral Data Fabric Database Shell

This section describes how to query JSON documents using either the find or findbyid command in HPE Ezmeral Data Fabric Database Shell (dbshell). It introduces the functionality the find command supports and describes the two ways to specify your queries. It also provides links to reference pages and examples.

The findbyid command allows you to retrieve a single document with a specified id from a HPE Ezmeral Data Fabric Database JSON table.

The find command allows you to specify projections and filter conditions (using JSON strings) to retrieve specific documents. It also allows you to specify the following options:

To invoke HPE Ezmeral Data Fabric Database shell, run the following command on a MapR cluster node:
% mapr dbshell

For a complete list and description of options available, see dbshell find or findbyid.

Alternatives for Writing Dbshell Query Commands

You can construct your dbshell queries in one of two ways:

The following example illustrates the differences between the two alternatives.

Suppose you want to query the table /apps/tab with the following criteria:

Click on each of the following tabs to see the syntax for each alternative:

Use Individual Options in find
find /apps/tab --fields f1,f2 --limit 10 --offset 2 --where {"$eq":{"f3":15}} --orderby f1
Use the --query Option in find
find /apps/tab --query {"$select":["f1","f2"],"$limit":10,"$offset":2,"$where":{"$eq":{"f3":15}},"$orderby":"f1"}

For more examples on how to use the two query alternatives, see the following links:

Use Individual Options in find Use the --query Option in find
Query Examples with Other Options
Note: With both options, you need to specify the query condition using OJAI Query Condition Syntax.