本文介绍了GORM:什么是引用:在Grails域类映射块中为true?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  

它看起来像参考 $ b

当 true 时,相关文件被,如果 false ,GORM插入简单的 id ,又名手动引用在mongo中


public class Address {
    static mapWith = "mongo"

    Region region;
    Zone zone;

    static mapping = {
        id generator: 'identity'
        region reference:true
        zone reference:true
    }
}

I'm interested in knowing what reference:true does.

In my experience, leaving it off gives exactly the same result except there's no DBRef in the actual mongo document.

解决方案

It looks like reference controlls how documents are linked.

When true, the related documents are referenced by db-refs, if false, GORM inserts simple id, aka Manual references in mongo

这篇关于GORM:什么是引用:在Grails域类映射块中为true?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 03:21