Skip to content

Commit 31402d0

Browse files
docs: updated docs for or operator
1 parent 1d05d7a commit 31402d0

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/lib/query.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { BaseQuery } from './base-query';
33
import { BaseQueryParameters, QueryOperation, QueryOperator, TaxonomyQueryOperation } from './types';
44
export class Query extends BaseQuery {
55
private _contentTypeUid?: string;
6-
private _subQueries: Query[] = [];
7-
86

97
constructor(client: AxiosInstance, uid: string, queryObj?: { [key: string]: any }) {
108
super();
@@ -204,16 +202,17 @@ export class Query extends BaseQuery {
204202
}
205203

206204
/**
207-
* @method notExists
205+
* @method or
208206
* @memberof Query
209207
* @description Returns the raw (JSON) query based on the filters applied on Query object.
210208
* @example
211209
* import contentstack from '@contentstack/delivery-sdk'
212210
*
213211
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
214-
* const query = stack.contentType("contentTypeUid").entry().query();
215-
* const result = notExists('fieldUid').find()
216-
*
212+
* const query1 = await contentType.Entry().query().containedIn('fieldUID', ['value']);
213+
* const query2 = await contentType.Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
214+
* const query = await contentType.Entry().query().or(query1, query2).find();
215+
*
217216
* @returns {Query}
218217
*/
219218
notExists(key: string): Query {

test/api/entry-queryables.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Query Operators API test cases', () => {
3737
expect((query.entries[0] as any).multi_line).not.toBeDefined()
3838
}
3939
});
40-
it('should return entries matching any of the conditions', async () => {
40+
it('should return entries matching any of the conditions - or', async () => {
4141
const query1: Query = await makeEntries('contenttype_uid').query().containedIn('title', ['value']);
4242
const query2: Query = await makeEntries('contenttype_uid').query().where('title', QueryOperation.EQUALS, 'value2');
4343
const query = await makeEntries('contenttype_uid').query().or(query1, query2).find<TEntry>();

test/unit/entry-queryable.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Query Operators API test cases', () => {
3131
const query = contentType.Entry().query().notExists('fieldUID');
3232
expect(query._parameters).toStrictEqual({'fieldUID': {'$exists': false}});
3333
});
34-
it('should return entries matching any of the conditions', async () => {
34+
it('should return entries matching any of the conditions - or', async () => {
3535
const query1: Query = await contentType.Entry().query().containedIn('fieldUID', ['value']);
3636
const query2: Query = await contentType.Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
3737
const query = await contentType.Entry().query().or(query1, query2);

0 commit comments

Comments
 (0)