Skip to content

How to insert data into JSON fields using the Local API with PostgreSQL backend? #8604

Answered by torse
torse asked this question in Q&A
Discussion options

You must be logged in to vote

Well, my mistake. The above actually works.

The problem in my case was a typo in another select field of the collection that had a wrong/not supported option. After fixing the typo, the JSON is correctly stored in the DB. It would be helpful though, if the local api would thrown an error instead of silently ignoring this.

Here is the more complex example using a json and the select field within an array:
Collection maps:

export const Maps: CollectionConfig = {
    ...
    {
      name: 'maps', // required
      type: 'array', // required
      fields: [
        {
          name: 'format',
          type: 'select',
          options: ['format1', 'format2'],
          required: true,
      …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by torse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant