Skip to content

Commit

Permalink
Add a section to the FAQ on order by prop of a Json value (#6498)
Browse files Browse the repository at this point in the history
* Add a section to the FAQ on order by prop of a Json value

This addresses this doc [issue](https://github.com/prisma/docs/issues/42660)

* Update content/200-orm/200-prisma-client/200-special-fields-and-types/100-working-with-json-fields.mdx

---------

Co-authored-by: Ankur Datta <[email protected]>
  • Loading branch information
ludralph and ankur-arch authored Dec 5, 2024
1 parent f81cfbf commit b3cea70
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,10 @@ No - it is not yet possible to filter on the presence of a specific key.

No - [case insensitive filtering](https://github.com/prisma/prisma/issues/7390) is not yet supported.

### Can you sort an object property within a JSON value?

No, [sorting object properties within a JSON value](https://github.com/prisma/prisma/issues/10346) (order-by-prop) is not currently supported.

### How to set a default value for JSON fields?

When you want to set a `@default` value the `Json` type, you need to enclose it with double-quotes inside the `@default` attribute (and potentially escape any "inner" double-quotes using a backslash), for example:
Expand All @@ -1011,4 +1015,4 @@ model User {
json1 Json @default("[]")
json2 Json @default("{ \"hello\": \"world\" }")
}
```
```

0 comments on commit b3cea70

Please sign in to comment.