My use case for Terrastore involves combining an action and a resource into 1 document for consumption by external users over the HTTP API. Currently the actions are under the action bucket and resources are under the resource bucket.
action/1111
action/1122
resource/db1
resource/db2
action/1111 = { "path" : "/some/path", "sw_version: "3.4.5", "resource" : "resource/db2" }
resource/db2 = { "url" : "
http://some.url/", "username" : "un", "password" : "pw", "db_name" : "mydb", "data_file" : "/another/path", "log_file" : "/third/path" }
I'd like to be able to provide some way to combine all of this information together, so I could get a result like this, referenced by action (it wouldn't be necessary to include the resource as long as it's contents are included):
{ "path" : "/some/path", "sw_version: "3.4.5", "resource" : "db2", "url" : "
http://some.url/", "username" : "un", "password" : "pw", "db_name" : "mydb", "data_file" : "/another/path", "log_file" : "/third/path" }
I'd prefer not to modify the original documents.
For something like this would you recommend terrastore.event.EventListener(s) on the action and resource buckets to keep a third document in sync, a custom terrastore.store.operators.Function to return the combined data, or something else?
I'll try a couple things, but was just curious if there was a recommended approach.
Thanks.