简体   繁体   中英

Jhipster - Modify existing MongoDB entity

I have an entity generated with JHipster.

myFile.json

{
"fluentMethods": true,
"relationships": [],
"fields": [
    {
        "fieldName": "fileName",
        "fieldType": "String"
    },
    {
        "fieldName": "file",
        "fieldType": "byte[]",
        "fieldTypeBlobContent": "any",
        "fieldValidateRules": [
            "required"
        ]
    },
    {
        "fieldName": "size",
        "fieldType": "String"
    },
    {
        "fieldName": "dateCreated",
        "fieldType": "ZonedDateTime",
        "fieldValidateRules": []
    },
    {
        "fieldName": "dateModified",
        "fieldType": "ZonedDateTime"
    },
    {
        "fieldName": "createdBy",
        "fieldType": "String"
    }
],
"dto": "mapstruct",
"service": "serviceClass",
"entityTableName": "my_file",
"jpaMetamodelFiltering": false,
"pagination": "pagination"

}

At this point I would like to add some fields. I want to add an Option field which would be Object[] type with name and desc fields. Is this the right way to do this?? Im thinking adding this code at the end of the fields..

    ...
    {
        "fieldName": "myFileOption",
        "fieldType": "Obejct[]",
        "fields" : [{
            "fieldName" : "name",
            "fieldType" : "String"
        },
        {
            "fieldName" : "desc",
            "fieldType" : "String"
        }
        ]
    }

You add entites with the entity generator, and then you can edit the json, and --regenerate

jhipster entity --skip-client Option

this is presuming that you want to add a now entity called Option .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM