Sasha
b878daf27a
feat(db-postgres): deep querying on json and rich text fields (#9102)
### What?
Allows to query on JSON / Rich Text fields in Postgres the same way as
in Mongodb with any nesting level.
Example:
Data:
```js
{
json: {
array: [
{
text: 'some-text', // nested to array + object
object: {
text: 'deep-text', // nested to array + 2x object
array: [10], // number is nested to array + 2x object + array
},
},
],
}
}
```
Query:
```ts
payload.find({
collection: 'json-fields',
where: {
and: [
{
'json.array.text': {
equals: 'some-text',
},
},
{
'json.array.object.text': {
equals: 'deep-text',
},
},
{
'json.array.object.array': {
in: [10, 20],
},
},
{
'json.array.object.array': {
exists: true,
},
},
{
'json.array.object.notexists': {
exists: false,
},
},
],
},
})
```
### How?
Utilizes [the `jsonb_path_exists` postgres
function](https://www.postgresql.org/docs/current/functions-json.html)
2024-11-12 09:26:04 +02:00
..
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-09-20 22:46:40 -04:00
2024-11-11 13:59:05 -05:00
2024-11-11 09:31:47 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-12 09:26:04 +02:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 19:28:55 -07:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-10-30 17:56:50 +00:00
2024-11-08 14:04:24 -05:00
2024-11-11 19:28:55 -07:00
2024-08-13 12:54:33 -04:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-07-23 13:44:44 -04:00
2024-11-11 09:31:47 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-09-20 22:46:40 -04:00
2024-09-20 22:46:40 -04:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-07-11 15:59:38 -04:00
2024-05-25 15:45:05 +00:00
2024-10-18 05:38:48 +00:00
2024-03-07 11:33:46 -05:00
2024-11-11 13:59:05 -05:00
2024-09-20 22:46:40 -04:00
2024-09-16 17:02:08 +00:00
2024-08-13 12:54:33 -04:00
2024-11-11 19:28:55 -07:00
2024-09-16 17:02:08 +00:00
2024-11-11 19:28:55 -07:00
2024-09-16 17:02:08 +00:00
2024-11-11 13:59:05 -05:00
2024-10-11 18:54:39 +00:00
2024-10-11 18:54:39 +00:00
2024-10-11 18:54:39 +00:00
2024-03-19 11:31:50 -04:00
2024-11-11 13:59:05 -05:00
2024-11-12 03:39:36 +00:00
2024-05-01 17:35:41 -04:00
2024-11-11 13:59:05 -05:00
2024-11-11 13:59:05 -05:00
2024-08-14 08:57:04 -04:00
2024-08-14 08:57:04 -04:00
2024-10-14 20:02:26 +00:00
2024-10-24 21:19:15 -04:00
2024-04-06 15:06:04 -04:00
2024-06-17 14:25:36 -04:00
2024-08-19 17:31:36 -04:00
2024-03-14 23:53:47 -04:00
2024-11-11 13:59:05 -05:00
2024-10-24 21:19:15 -04:00