loopback icon indicating copy to clipboard operation
loopback copied to clipboard

How to use embedsMany "scope" property?

Open Spark-star opened this issue 12 years ago • 1 comments

I have tried the example in the http://docs.strongloop.com/display/LB/Embedded+models+and+relations, I defined the models in the model.json, the "embedsMany" relation in model.json like this: Category.json "relations": { "items": { "type": "embedsMany", "model": "Link", "scope": { "include": "Product" } } } Link.json "relations": { "product": { "type": "belongsTo", "foreignKey": "id", "model": "Product", "properties": { "id" : "id", "name": "name", "title": "time" }, "options": { "invertProperties": true } } }, When I run the application, I found my dababase(mongodb) have the "Link" schema which I think should not be exist. When I delete the "scope": { "include": "Product" } in Category.json, nothing happened. So, I have two questions: 1.The Link schema should be exist? 2.How to use the "scope" in the relation? Thx

Spark-star avatar Sep 27 '14 10:09 Spark-star

Please post questions at https://groups.google.com/forum/#!forum/loopbackjs. See https://github.com/strongloop/loopback/wiki/Questions for more details. Closing.

superkhau avatar Feb 05 '16 17:02 superkhau