-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_query.ts
51 lines (41 loc) · 1.82 KB
/
test_query.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import NCMB, { NCMBObject, NCMBAcl, NCMBQuery, NCMBUser, NCMBGeoPoint } from './deno/ncmb.ts'
import { readJson } from 'https://deno.land/std@0.66.0/fs/read_json.ts'
const config = await readJson('./config.json') as { [s: string]: string }
const applicationKey = config.applicationKey
const clientKey = config.clientKey
new NCMB(applicationKey, clientKey);
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.equalTo('string', 'Hello').fetchAll()
console.log('equalTo', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.notEqualTo('string', 'Hello').fetchAll()
console.log('notEqualTo', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.lessThan('number', 200).fetchAll()
console.log('lessThan', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.lessThanOrEqualTo('number', 200).fetchAll()
console.log('lessThanOrEqualTo', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.lessThanOrEqualTo('date', new Date(2020, 8, 16, 9, 0, 0)).fetchAll()
console.log('lessThanOrEqualTo (date)', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.lessThan('date', new Date(2020, 8, 16, 9, 0, 0)).fetchAll()
console.log('lessThan (date)', results.length, results[0].get('objectId'))
})();
(async () => {
const query = new NCMBQuery('QueryTest');
const results = await query.in('array', ['c']).fetchAll()
console.log('in', results.length, results[0].get('objectId'))
})();