0

I understand that in usergrid UI I can create an Individual collection , but it does not allow me to create a collection under a collection. Is there a way of doing that . Otherwise we will be forced to write business logic in the proxy layer which we don't want to do.

With Regards -S

user2825273
  • 565
  • 1
  • 4
  • 9

1 Answers1

0

There is no concept of subcollection, but you can use connections. So you can do something like this:

POST cats/fluffy/hasa/toys/ball

The above would mean that that an entity of type "cat" is connected to an entity of type "toy" that is called "ball" by a connection verb "hasa".

You can also store sub-objects in an individual entity (e.g. full JSON is supported). If you want to describe your use-case a bit more, I can maybe recommend other ways to structure your data.

rockerston
  • 521
  • 2
  • 10
  • Thanks for getting back Rodr regarding API (sub)collections in Usergrid . Some followup questions: I am trying to create a resource of the form v1/customers/{id}/summary in usergrid, but it does not allow me to do that. I am forced into creating a /summaries collection. I want to be able to create a url , feed in an 'id' & get back summary details for that particular id. Second question is the returned JSON has a lot of associated metadata like UUID. How can I suppress that to return just the data I need? – user2825273 Dec 03 '14 at 01:01
  • Unfortunately, you are likely out of luck on both fronts. Usergrid always pluralizes collection names (e.g. cat becomes cats). Perhaps not the best idea, but it seemed to make sense at the time (years ago). To my knowledge, there is no way to change this (without changing the core code). On the second issue, it is possible to get only specific fields, but they aren't returned in a nice way. You would do this with a query. For example: GET /cats?select color, age, name where created > 0. You will see that the data doesn't have the associated key, so you have to trust the order. – rockerston Dec 04 '14 at 01:44