Query and projection operators

HCL OneDB™ supports a subset of the MongoDB query and projection operators.

You can refine your queries with the MongoDB query and projection operators. For example, in the mongo shell, to find members of the cartype collection with an age greater than 10, you can use the $gt operator: db.cartype.find({"age":{"$gt":10.0}}).

The JSON wire listener supports the skip, limit, and sort query options. You can set these options by using the mongo shell or MongoDB drivers.

Query selectors

Use query selectors to select specific data from queries.
Array query operators
Table 1. Array query operators
MongoDB command JSON collections Relational tables Details
$elemMatch Yes No
$size Yes No
Comparison query operators
Table 2. Comparison query operators
MongoDB command JSON collections Relational tables Details
$all Yes Yes Supported for primitive values and simple queries only. The operator is only supported when it is the only condition in the query document.
$eq Yes Yes
$gt Yes Yes
$gte Yes Yes
$in Yes Yes
$lt Yes Yes
$lte Yes Yes
$ne Yes Yes
$nin Yes Yes
$query Yes Yes
Element query operators
Table 3. Element query operators
MongoDB command JSON collections Relational tables Details
$exists Yes No
$type Yes No
Evaluation
Table 4. Evaluation query operators
MongoDB command JSON collections Relational tables Details
$mod Yes Yes
$regex Yes Yes The only supported value for the $options flag is i, which specifies a case-insensitive search.
$text Yes Yes

The $text query operator support is based on MongoDB version 2.6.

You can customize your text index and take advantage of additional text query options by creating a basic text search index with the createTextIndex command. For more information, see HCL OneDB JSON commands.

$where No No
Geospatial query operators
Geospatial queries are supported by using the GeoJSON format. The legacy coordinate pairs are not supported.
Table 5. Geospatial query operators
MongoDB command JSON collections Relational tables Details
$geoWithin Yes No
$geoIntersects Yes No
$near Yes No
$nearSphere Yes No
JavaScript™ query operators
The JavaScript query operators are not supported.
Logical query operators
Table 6. Logical query operators
MongoDB command JSON collections Relational tables Details
$and Yes Yes
$or Yes Yes
$not Yes Yes
$nor Yes Yes

Projection operators

Use projection operators to select specific data from a document.
Projection operators
Table 7. Projection operators
MongoDB command JSON collections Relational tables Details
$ No No
$elemMatch Yes No
$meta Yes Yes
$slice No No
Query modifiers
Table 8. Query modifiers
MongoDB command JSON collections Relational tables Details
$comment No No
$explain Yes Yes
$hint Yes No
$orderby Yes Yes

For more information about the MongoDB features, see http://docs.mongodb.org/manual/reference/.