Can’t get joins to work. The business document is ...
# community-help
t
Can’t get joins to work. The business document is not joined in my document results. API Call
Copy code
{
    collection: 'users',
    filters: {
      q: '*',
      filter_by: 'role:professional',
      include_fields: '$businesses(*)',
    },
  }
Users Schema
Copy code
await typesense.collections().create({
        name: 'users',
        fields: [
          { name: 'name', type: 'string' },
          { name: 'username', type: 'string' },
          { name: 'bio', type: 'string', optional: true },
          { name: 'tags', type: 'string[]', optional: true },
          { name: 'profilePhoto', type: 'string', index: false, optional: true },
          { name: 'address.city', type: 'string', optional: true },
          { name: 'address.state', type: 'string', optional: true },
          { name: 'address.zip', type: 'string', optional: true },
          { name: 'address.country', type: 'string', optional: true },
          { name: 'address.location.coordinates', type: 'geopoint', sort: true, optional: true },
          { name: 'businessId', type: 'string', optional: true, reference: 'businesses.id' },
          { name: 'role', type: 'string' },
          { name: 'createdAt', type: 'int64' },
          { name: 'updatedAt', type: 'int64' },
        ],
        enable_nested_fields: true,
      });
Businesses Schema
Copy code
await typesense.collections().create({
        name: 'businesses',
        fields: [
          { name: 'name', type: 'string', optional: true },
          { name: 'tags', type: 'string[]', optional: true },
          { name: 'billing.plan', type: 'string', optional: true },
          { name: 'billing.subscribed', type: 'bool', optional: true },
          { name: 'locations', type: 'object[]', optional: true },
          { name: 'locations.mobile', type: 'bool[]' },
          { name: 'locations.address', type: 'object', optional: true },
          { name: 'locations.address.city', type: 'string[]', optional: true },
          { name: 'locations.address.state', type: 'string[]', optional: true },
          { name: 'locations.address.zip', type: 'string[]', optional: true },
          { name: 'locations.address.country', type: 'string[]', optional: true },
          { name: 'locations.address.location.coordinates', type: 'geopoint', sort: true, optional: true },
          { name: 'createdAt', type: 'int64' },
          { name: 'updatedAt', type: 'int64' },
        ],
        enable_nested_fields: true,
      });
j
Could you make sure you're running v26.0 of Typesense? JOINs only exists in that version
t
I am
Running the latest versions of the Typesense server and SDK
This is the result I get back
message has been deleted
Is request params supposed to include the
include_fields
?
j
No the request params response key doesn't include all the parameters exhaustively, it contains just enough info for common UI rendering use-cases we've seen
Is this on Typesense Cloud btw?
t
This is locally using docker
j
Hmm, could you give me a set of curl commands like this that I can run locally that replicates the issue?
t
Strange, So after creating and testing the curl commands, it seems to work.
🤦🏽‍♂️ I think React Query was caching the results. It seems to be working after all.
👍 1