3
I’m working with the Datastore from Google and I’m unable to mount a Query to return what I need.
Situation
I have a Entity
, keyed {"item": codItem, "item": id}
, still within that Entity I have the property codCliente.
For example we could have a JSON thus being saved (id
is the field of registration google generates):
[
{"id":2137847312334,"codItem":12,"codCliente":1,"dataRegistro":2017-04-23T18:25:43.511Z},
{"id":2183462352427,"codItem":15,"codCliente":1,"dataRegistro":2017-04-23T18:25:43.511Z},
{"id":9128734678236,"codItem":10,"codCliente":1,"dataRegistro":2017-04-23T18:25:43.511Z},
{"id":2137847312334,"codItem":12,"codCliente":1,"dataRegistro":2017-03-20T18:25:43.511Z},
{"id":2183462352427,"codItem":15,"codCliente":1,"dataRegistro":2017-03-20T18:25:43.511Z},
{"id":9128734678236,"codItem":10,"codCliente":1,"dataRegistro":2017-03-20T18:25:43.511Z}
]
Problem
When I mount the query to search for these results filtering by client, with the codCliente
I still don’t have the information of which codItem
that he has.
And what I need is a way to only seek one (only one) result from each codItem
of codCliente
referenced with the dataRegistro
newer. This way with the above example I should have to return the first three JSON records.
I’m open to changes in structure and json document keys. The only thing there is no changing is about having the information of which codItem
the customer has before making the query. Any idea?