Informix query operators and modifier

The Informix® query operators and modifier are extensions to the MongoDB API.

Query operators

You can use the Informix query operators in all MongoDB functions that accept query operators, for example find() or findOne().
$ifxtext
The $ifxtext query operator is similar to the MongoDB $text operator, except that it passes the search string as-is to the bts_contains() function.
When using relational tables, the MongoDB $text and Informix $ifxtext query operators both require a column name, specified by $key, in addition to the $search string.
The search string can be a word or a phrase as well as optional query term modifiers, operators, and stopwords. You can include field names to search in specific fields. The syntax of the search string in the $ifxtext query operator is the same as the syntax of the search criteria in the bts_contains() function that you include in an SQL query.
In the following example, a single-character wildcard search is run for the strings text or test:
db.collection.find( { "$ifxtext" : { "$search" : "te?t } } )
$like
The $like query operator tests for matching character strings and maps to the SQL LIKE query operator. For more information about the SQL LIKE query operator, see LIKE Operator.
In the following example, a wildcard search is run for strings that contain machine:
db.collection.find( { "$like" : "%machine%" )

Query modifier

You can use the Informix query modifier in the MongoDB find() function with the addSpecial function.
$nativeCursor
The $nativeCursor query modifier holds open a true cursor on the Informix database server during a query. A native cursor requires more wire listener resources because connections and result set objects are tied to a single session, but the cursor guarantees consistent query results. You can control the cursor idle timeout with the cursor.idle.timeout wire listener property. For REST API queries, use the killCursors command to close the cursor.
In the following example, query results are returned in a cursor:
Note: For Mongo client applications, whether you are able to add Informix specific query or cursor modifiers is highly dependent on the Mongo driver you are using. Many of the latest Mongo driver do not support non-standard options in the addSpecial API.
db.collection.find().addSpecial("$nativeCursor",1);