Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field name inconsistencies and not updating correctly #508

Closed
niallobrien opened this issue Jan 24, 2018 · 5 comments
Closed

Field name inconsistencies and not updating correctly #508

niallobrien opened this issue Jan 24, 2018 · 5 comments
Assignees
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@niallobrien
Copy link

Node.js version: 8.9.0
npm version: 5.5.1
Strapi version: 3.0.0-alpha.8.3
Operating system: Windows 7 (Enterprise)

Hi, I created a Post content type and added a String field with a name of "Title". There are inconsistencies as to how this is then used and displayed. For example, the key is stored as "Title" in MongoDB and the API also returns this capitalised key. I believe that the case of all field names should be adjusted to lowercase before storing in Mongo and simply capitalise these strings when rendering in the UI.

Also, once I realised this, I edited the field name to change it lowercase and now my collection in Mongo contains two "title" ("Title" and "title") fields which is incorrect, it should have updated the existing key.

image

Thanks.

@lauriejim lauriejim added issue: enhancement Issue suggesting an enhancement to an existing feature version: 3.x severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve labels Jan 25, 2018
@lauriejim
Copy link
Contributor

Hello @niallobrien Can you give me the process you did to have this issue (be more precise as you can please)

@derrickmehaffy
Copy link
Member

@lauriejim I have noticed the same issue.

  • Create a content type that contains a string with the name Title
  • Note that strapi by default did not change "Title" to "title" when storing in the database
  • Change the string in the content builder from "Title" to "title"
  • Update the record via the admin UI
  • Note that the database now contains two values "Title" and "title" instead of updating the key it created a new one and did not remove the old one.

though if I have described this wrong, I'm sure @niallobrien can correct me.

@derrickmehaffy
Copy link
Member

I believe this issue is also partially related to #661 as the user in this case wished to have the string name "Title" appear but store it in the database as "title".

The issue of displaying values on the admin UI and how they are stored/shown on the endpoints is a common issue. Although changing content field names doesn't appear to update in the database (the same applies to changing the entire content name. Say in this case "title" is contained in "Posts" where as it should be stored in the database as "posts".

I'd imagine changing this value manually would not update the database but instead create a new entry "posts"

@niallobrien
Copy link
Author

@derrickmehaffy Perfect explanation, thank you. Yes, this is correct.

@lauriejim lauriejim added status: confirmed Confirmed by a Strapi Team member or multiple community members and removed status: have to reproduce labels Feb 21, 2018
@lauriejim
Copy link
Contributor

Okay I understand your needs. I close this issue but still #661 open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

No branches or pull requests

4 participants