duyluonglc / lucid-mongo

Mongodb ODM for adonis framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is it possible to use ReferMany under EmbedOne

npraew opened this issue · comments

for example, I assume that we have 3 class

class Master extends Model {
  embed() {
    return this.embedsOne('EmbedMaster', '_id', 'embed')
  }
}

class EmbedMaster extends Model {
  refers() {
    return this.referMany('Child', '_id', 'refers')
  }
}

class Child extends Model {
}

do you have a way to insert and select all this data in efficient way? (have only 2 table, Master and Child)