Skip to content

Commit a6b3bad

Browse files
feat: notExists query operator implementation
1 parent fbf0d7a commit a6b3bad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/lib/query.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,22 @@ export class Query extends BaseQuery {
200200
this._parameters[key] = { '$nin': value };
201201
return this;
202202
}
203+
204+
/**
205+
* @method notExists
206+
* @memberof Query
207+
* @description Returns the raw (JSON) query based on the filters applied on Query object.
208+
* @example
209+
* import contentstack from '@contentstack/delivery-sdk'
210+
*
211+
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
212+
* const query = stack.contentType("contentTypeUid").Query();
213+
* const result = notExists('fieldUid').find()
214+
*
215+
* @returns {Query}
216+
*/
217+
notExists(key: string): Query {
218+
this._parameters[key] = { '$exists': false };
219+
return this;
220+
}
203221
}

0 commit comments

Comments
 (0)