You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 22, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: docs/functions.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ The [facade](./facade.md) contains common functions for storage and retrieval of
12
12
-[replaceEntity](#replaceentity)
13
13
14
14
### countEntities
15
-
Counts the number of entities that match the [`filter`](./filter.md) option.
15
+
Counts the number of entities that match the [`filter`](./options.md#filter) option.
16
16
17
17
```ts
18
18
const { count } =awaitfacade.countEntities({
@@ -44,7 +44,7 @@ try {
44
44
This package contains the [create entity tests](../src/tests/createEntity) and the [create entity signature](../src/signatures/CreateEntity.ts) for this function.
45
45
46
46
### getEntities
47
-
Retreives a sorted paginated array of entities that match the [`filter`](./filter.md) option.
47
+
Retreives a sorted paginated array of entities that match the [`filter`](./options.md#filter) option.
This package contains the [get entities tests](../src/tests/getEntities) and the [get entities signature](../src/signatures/GetEntities.ts) for this function.
68
68
69
69
### getEntity
70
-
Retrieves a single entity that matches the [`id`](./options.md#id) and [`filter`](./filter.md) options.
70
+
Retrieves a single entity that matches the [`id`](./options.md#id) and [`filter`](./options.md#filter) options.
This package contains the [get entity tests](../src/tests/getEntity) and the [get entity signature](../src/signatures/GetEntity.ts) for this function.
89
89
90
90
### patchEntity
91
-
For an entity that matches the [`id`](./options.md#id) and [`filter`](./filter.md) options, it changes some of an entity's properties using the [`patch`](./options.md#patch) option.
91
+
For an entity that matches the [`id`](./options.md#id) and [`filter`](./options.md#filter) options, it changes some of an entity's properties using the [`patch`](./options.md#patch) option.
This package contains the [patch entity tests](../src/tests/patchEntity) and the [patch entity signature](../src/signatures/PatchEntity.ts) for this function.
111
111
112
112
### removeEntities
113
-
Removes all entities that match the [`filter`](./filter.md) option.
113
+
Removes all entities that match the [`filter`](./options.md#filter) option.
114
114
115
115
```ts
116
116
awaitfacade.removeEntities({
@@ -121,7 +121,7 @@ await facade.removeEntities({
121
121
This package contains the [remove entities tests](../src/tests/removesEntities) and the [remove entities signature](../src/signatures/RemoveEntities.ts) for this function.
122
122
123
123
### removeEntity
124
-
Removes an entity that matches the [`id`](./options.md#id) and [`filter`](./filter.md) options.
124
+
Removes an entity that matches the [`id`](./options.md#id) and [`filter`](./options.md#filter) options.
This package contains the [remove entity tests](../src/tests/removesEntity) and the [remove entity signature](../src/signatures/RemoveEntity.ts) for this function.
143
143
144
144
### replaceEntity
145
-
For an entity that matches the [`id`](./options.md#id) and [`filter`](./filter.md) options, it changes all of an entity's properties using the [`entity`](./options.md#entity) option.
145
+
For an entity that matches the [`id`](./options.md#id) and [`filter`](./options.md#filter) options, it changes all of an entity's properties using the [`entity`](./options.md#entity) option.
This is an object containing some of the entity's properties. This package uses [TypeScript's Partial type](https://www.typescriptlang.org/docs/handbook/advanced-types.html) applied to an [Entity](#entity) (using `Partial<Entity>`).
37
37
38
38
### Filter
39
-
This is an object that filters the entities. More information can be found in the [filter documentation](./filter.md). This package contains the [TypeScript Filter type definition](../src/types/Filter.ts).
39
+
This is an object that filters the entities. The [filter type definition](../src/types/Filter.ts) currently supports the following operators which have been [borrowed from Mongo](https://docs.mongodb.com/manual/reference/operator/query/).
40
+
41
+
Operator | Description
42
+
--- | ---
43
+
[$and](https://docs.mongodb.com/manual/reference/operator/query/and/#op._S_and) | Includes entities where all of the specified filters are true.
44
+
[$or](https://docs.mongodb.com/manual/reference/operator/query/or/#op._S_or) | Includes entities where some of the specified filters are true.
45
+
[$nor](https://docs.mongodb.com/manual/reference/operator/query/nor/#op._S_nor) | Includes entities where some of the specified filters are false.
46
+
[$not](https://docs.mongodb.com/manual/reference/operator/query/no/#op._S_no) | Includes entities where a specified filter is not true.
47
+
[$eq](https://docs.mongodb.com/manual/reference/operator/query/eq/#op._S_eq) | Includes entities where the value of a given property is equal to the specified value.
48
+
[$ne](https://docs.mongodb.com/manual/reference/operator/query/ne/#op._S_ne) | Includes entities where the value of a given property is not equal to the specified value.
49
+
[$lt](https://docs.mongodb.com/manual/reference/operator/query/lt/#op._S_lt) | Includes entities where the value of a given property is less than the specified value.
50
+
[$lte](https://docs.mongodb.com/manual/reference/operator/query/lt/#op._S_lt) | Includes entities where the value of a given property is less than or equal to the specified value.
51
+
[$gt](https://docs.mongodb.com/manual/reference/operator/query/gt/#op._S_gt) | Includes entities where the value of a given property is greater than the specified value.
52
+
[$gte](https://docs.mongodb.com/manual/reference/operator/query/gt/#op._S_gt) | Includes entities where the value of a given property is greater than or equal to the specified value.
53
+
[$in](https://docs.mongodb.com/manual/reference/operator/query/in/#op._S_in) | Includes entities where the value of a given property is equal to one of the specified values.
54
+
[$nin](https://docs.mongodb.com/manual/reference/operator/query/ni/#op._S_ni) | Includes entities where the value of a given property is not equal to any of the specified values.
55
+
56
+
The filter below is comprehensive example using all of the operators.
57
+
58
+
```json
59
+
{
60
+
"$or": [
61
+
{
62
+
"numberProp1": {
63
+
"$not": {
64
+
"$gt": 0,
65
+
"$lt": 1
66
+
}
67
+
}
68
+
},
69
+
{
70
+
"$and": [
71
+
{
72
+
"stringProp1": "string value 1",
73
+
"numberProp2": {
74
+
"$gte": 0,
75
+
"$lte": 1
76
+
},
77
+
"numberProp3": { "$ne": 0 },
78
+
"numberProp4": { "$eq": 0 }
79
+
},
80
+
{
81
+
"stringProp2": {
82
+
"$in": ["string value 2", "string value 3"]
83
+
},
84
+
"stringProp3": {
85
+
"$nin": ["string value 4", "string value 5"]
86
+
}
87
+
}
88
+
]
89
+
},
90
+
,
91
+
{
92
+
"$nor": [
93
+
{
94
+
"stringProp4": "string value 6"
95
+
}
96
+
]
97
+
}
98
+
]
99
+
}
100
+
```
101
+
40
102
41
103
### Sort
42
104
This is an object where a key represents the entity property to be sorted and the value represents the direction to sort. The value should be `true` to sort in ascending order and `false` to sort in descending order. The properties are sorted in order of their definition in the sort option, for example, the following sort option `{ createdAt: false, id: true }` will sort by the `createdAt` property first and then the the `id` property.
0 commit comments