如何建立收藏夹文件之间的关系

时间:2019-01-08 06:13:10

标签: mongodb laravel-5



 this is the structure of my collections sales collection {
     "_id" : ObjectId("5bfb6ee3636239094b2fb6c3"),
    "items" : [ 
         {
             "_id" : ObjectId("5bfbaa776362390f8f28bf42"),
            "item_id" : 15703,
             "name" : "06455kr3404",
             "code" : "18201",
             "quantity" : 1,
             "price_per_unit" : 100000,
             "total_bef_disc" : 100000,
             "total_aft_disc" : 88000,
             "disabled" : false,
             "inventorable" : false,
             "average_cost" : 0,
             "disc" : 12000,
            "location" : null,
             "updated_at" : ISODate("2018-12-11T06:48:07.000Z"),
             "cogs_per_unit" : 0,
             "total_cogs" : 0
         }
     ],
     "total_bef_disc" : 123000,
     "total_aft_disc" : 108460,
     "tota_payment" : 0,
     "disc" : 14540,
     "difference" : 81540,
     "updated_at" : ISODate("2018-12-11T06:48:07.000Z"),
     "created_at" : ISODate("2018-11-26T03:56:19.000Z"),
     "total_payment" : 190000,
     "total_cogs" : 5882,

 "closed_at" : ISODate("2018-12-11T06:48:07.000Z") } 
this collection sales_retur` { "_id" : ObjectId("5c1c7e4363623908f66f9214"), "sales_id" : "5bfb6ee3636239094b2fb6c3", "total_return" : 111111, "updated_at" : ISODate("2018-12-21T05:56:19.000Z"), "created_at" : ISODate("2018-12-21T05:46:43.000Z"), "reason" : null, "inventory_confirmation_required" : false, "total_payment" : 0, "items" : [ { "_id" : ObjectId("5bfbaa776362390f8f28bf42"), "item_id" : 4, "name" : "06455kr3404", "code" : "13538KGH900", "quantity" : 1, "total_return" : 111111, "return_price_per_unit" : 111111, "max_total_return" : 17600, "updated_at" : ISODate("2018-12-21T05:56:19.000Z") } ] } how to make a relationship between embeds items in a collection sales with embeds items in collateral sales returns ?

0 个答案:

没有答案