Skip to content

embedsMany relationship publishes count on swagger, but it does not exist or work #956

Closed

Description

@mitsos1os

When implementing an embedsMany relationship, the endpoints automatically created, expose a count method. Also in code, the relationName has a count property - method.

The problem is that neither of them works. This can also be verified in the official loopback-example-relations
ex:

// Customer with emails is probably id 7
Customer.findById(7)
  .then(customer => {
    return customer.emails.count()
  })
  .then(count => {
    console.log(count); // It should be 2 as created in example, but it shows 0
  })

Also issuing a GET /api/Customers/7/emails/count results with "count":0, while at the same time GET /api/Customers/7/emails/ returns a list of 2 emails

Activity

  1. changed the title [-]embedsMany relationship publishes **count** on swagger, but it does not exist or work[/-] [+]embedsMany relationship publishes count on swagger, but it does not exist or work[/+] on Jun 1, 2016
  2. jannyHou commented on Aug 12, 2016

    @jannyHou
    Contributor

    A duplidate bug as #258
    To keep it easy to track, let's keep the update of fix and further discussion under that one.
    I am closing this issue. Thanks for understanding :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions