anlek/mongify

embed_in issue with key

Opened this issue · 1 comments

I want to embed a table (say B) into other table(say A) without defining a key in table A. Is it possible?

For example: I tried translation rb file as below:
table "category" do
column "id", :as => :integer
column "category_name", :string
column "actor_type", :integer
column "description", :string
column "status", :integer
column "created_date", :datetime
column "created_by", :string
column "modified_date", :datetime
column "modified_by", :string
column "default_category", :string
end

table "category_permission", :embed_in => :category, :on => :category_id do
column "id", :as => :integer
column "category_id", :integer, :references => :category
column "permission_id", :integer
column "total_velocity", :integer
column "failure_velocity", :integer
column "status", :integer
column "created_by", :string
column "created_date", :date
end

And I need output as below:

{
"id" : 1,
"category_name" : "system_merchant_category",
"actor_type" : 10036,
"description" : "Default merchant category",
"status" : 10000,
"created_date" : ISODate("2014-05-22T22:45:24Z"),
"created_by" : "SYSTEM",
"modified_date" : null,
"modified_by" : null,
"default_category" : "Y",
"category_permission" : [
{
"id" : "1",
"permission_id" : 10009,
"total_velocity" : 600,
"failure_velocity" : null,
"status" : 10001,
"created_by" : "SYSTEM",
"created_date" : ISODate("2014-05-23T18:30:00Z")
}
]}

anlek commented

I'm not sure what you mean. Can you explaining using your example?