Hi guys, could I get some help on a querying pleas...
# community-help
k
Hi guys, could I get some help on a querying please? Example below 10 documents in a collection (collection-A), 3 of which reference another collection (collection-B). How can I return all 10 documents but the 3 that share the reference should be grouped in 1 item and the other 7 returned as their invidual documents. So total of 8 documents returned
k
cc @Harpreet Sangar
h
@Kenn Seangpachareonsub do you wish to group those 3 documents regardless of which document of collection-B they reference?
k
Hi Harpreet, I actually managed to do it yesterday - thanks for the help tho!
Also I noticed there may be a bug on the platform within my staging cluster. If you wanted to check it out?
h
I actually managed to do it yesterday - thanks for the help tho!
Mind sharing how you achieved it?
Also I noticed there may be a bug on the platform within my staging cluster. If you wanted to check it out?
For sure.
k
> Mind sharing how you achieved it?
Copy code
?q=*&group_by=tourId&group_limit=1&group_missing_values=false&include_fields=$tour(*, strategy:nest)
> For sure I dropped a field from my schema and then re-added it straight after with faceting and async referencing etc. It says the schema has been updated but it doesn't show up on the schema and I can't search against the field (error returns saying the field doesn't exist) but I can't re-add the field now cause it says it's existing already 😅
h
We don't support adding a reference field with alter operation. So you'll have to drop the whole collection and then create it again.
k
ahh interesting
will do that then! but maybe one to look at in terms of mismatch of schemas between writing and reading - saying it exists but can't search against it
h
Maybe we should return an error during the schema alter operation.
🙌 1
k
@Harpreet Sangar 🙏 i was wondering if you know whether faceting and referencing work on nested objects? for some reason facet is set to false for my nested object fields
this is the field in the schema
Copy code
{
        "name": "show",
        "type": "object",
        "fields": [
          {
            "name": "id",
            "type": "string",
            "reference": "show.id",
            "async_reference": true,
            "facet": true
          },
          { "name": "slug", "type": "string" }
        ]
      },
h
We follow
Object_name.field_name
convention to declare the object fields in the schema like:
Copy code
{ "name": "show", "type": "object"},
{ "name": "show.id", "type": "string", "reference": "show.id", "async_reference": true, "facet": true }
{ "name": "show.slug", "type": "string" }
k
ahh right that makes sense - okay will try that thank you