loopback icon indicating copy to clipboard operation
loopback copied to clipboard

BUG GET \parents\{pk}\children\count on embedsMany and referencesMany

Open veekungx opened this issue 12 years ago • 9 comments

when declared relation like this

{
     name : "Parent"
     relations: {
        "type": "embedsMany",
      "model": "Child"
     }
}

then call GET /parents/{pk}/children/count

It count on Child collection instead of sub-document

veekungx avatar Sep 18 '14 11:09 veekungx

+1

barocsi avatar Jan 28 '16 22:01 barocsi

It appears we have now encocuntered the same issue with ReferencesMany

I think it's related to this line in /loopback-datasource-juggler/lib/scope.js: var targetModel = definition.targetModel(this._receiver);

MarkAndrewJohnson avatar Jul 05 '16 00:07 MarkAndrewJohnson

@fabien would you now have a resolution for this issue?

MarkAndrewJohnson avatar Jul 05 '16 00:07 MarkAndrewJohnson

We encounter the same issue on loopback 2.22, any progress on a possible fix ?

pierreclr avatar Sep 19 '16 13:09 pierreclr

I have the same problem, I try and write something right ring but I can not function that I write in the script of the model.

Fercho191 avatar Sep 24 '16 03:09 Fercho191

Adding P1 as many community members are reporting in multiple areas - embedsMany, ReferencesMany.

rashmihunt avatar Jun 28 '17 21:06 rashmihunt

@fabien , saw you assigned it to yourself. Are you planning to submit a PR?

dhmlau avatar Jul 05 '17 02:07 dhmlau

@dhmlau it's been since 2014 - still working with Loopback, but unable to set aside time for a PR right now.

fabien avatar Jul 06 '17 07:07 fabien

There have been recent changes to how count is returned in some connectors; if you can provide an example repository in GitHub to demonstrate the issue, we can revisit it but at this time this is not a priority for us.

kjdelisle avatar Sep 11 '17 18:09 kjdelisle