首页 > 解决方案 > 删除 ATL ATLAS 转换语言中每个集合的重复项

问题描述

我有一组包含字段的文档(NoSql 文档),每个字段都包含一个键,如下面的元模型所示:Nosql 元模型

我的问题:我如何才能从所有文档中只获取唯一键,我尝试了使用此代码的助手:

helper context MDB_metamodel!collection def: MongoToSql1(): 
String='\n------------------------------------ \n -- ********* Creation of table '+self.name+ ' **'+'\n\n'+
    'CREATE TABLE `' + self.name + '` ( \n' 
            
    +self.document->asSequence()->
    iterate(d;acc:String=''|acc+ if acc='' then acc+d.field.asSet()->
    collect(f|f.key.MongoToSql12()) else ', \n'  + if  d.field.asSet()->
    collect(f|f.key.MongoToSql12()) <> acc then d.field.asSet()->
    collect(f|f.key.MongoToSql12()) else ''  endif endif)
    ;

标签: collectionsduplicateseclipse-emfmetamodel

解决方案


推荐阅读