简体   繁体   English

Jhipster - 修改现有的 MongoDB 实体

[英]Jhipster - Modify existing MongoDB entity

I have an entity generated with JHipster.我有一个用 JHipster 生成的实体。

myFile.json我的文件.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.我想添加一个Option字段,它是带有 name 和 desc 字段的 Object[] 类型。 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你用实体生成器添加实体,然后你可以编辑json,然后--regenerate

jhipster entity --skip-client Option

this is presuming that you want to add a now entity called Option .这是假设您要添加一个名为Option的 now 实体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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