loopback icon indicating copy to clipboard operation
loopback copied to clipboard

How can i get only some fields of related models ?

Open bluestaralone opened this issue 12 years ago • 1 comments

Think about models Book and Category, Book can belongsTo many Category and Category can have many Books I'm using this relation in Book model as below:

Book can have some properties like "title", "description", "created",...
Category can have some properties like "name", "id", ...

"categories": {
      "type": "referencesMany",
      "model": "Category"
    },

Question is how can i get list of Books with some fields: {"field": {"title": true, "description": true, "categories.name": true}, "include":["categories"]}

This is not work for me. Please tell me syntax for filter that included property of related model.

bluestaralone avatar Oct 13 '14 08:10 bluestaralone

Duplicate of https://github.com/strongloop/loopback-datasource-juggler/pull/324

raymondfeng avatar Oct 13 '14 15:10 raymondfeng