diff --git a/lib/mapping/q.js b/lib/mapping/q.js index fa82b0f1e..2641aabb9 100644 --- a/lib/mapping/q.js +++ b/lib/mapping/q.js @@ -76,6 +76,8 @@ class QueryAssignment { * Contains functions that represents operators in a query. * @alias module:mapping~q * @type {Object} + * @property {function} contains Represents the CQL operator "CONTAINS". + * @property {function} containsKey Represents the CQL operator "CONTAINS KEY". * @property {function} in_ Represents the CQL operator "IN". * @property {function} gt Represents the CQL operator greater than ">". * @property {function} gte Represents the CQL operator greater than or equals to ">=" . @@ -91,6 +93,14 @@ class QueryAssignment { * @property {function} remove Represents the CQL remove assignment used for collections, e.g: "col = col - x" */ const q = { + contains: function contains(value) { + return new QueryOperator('CONTAINS', value); + }, + + containsKey: function containsKey(value) { + return new QueryOperator('CONTAINS KEY', value); + }, + in_: function in_(arr) { if (!Array.isArray(arr)) { throw new errors.ArgumentError('IN operator supports only Array values'); @@ -119,7 +129,7 @@ const q = { }, and: function (condition1, condition2) { - return new QueryOperator('AND', [ condition1, condition2 ], true); + return new QueryOperator('AND', [condition1, condition2], true); }, incr: function incr(value) {