Querying Channels Based on Custom Data in React Stream Chat

392 Views Asked by At

I'm currently working with React Stream Chat and I am attempting to perform a query on the custom data within my channel objects. Each channel object contains a custom data object named "channel_detail" which is structured as follows:

channel_detail: {
    postID: '1234',
    offers: [{
        id: '2345',
        amount: 12
    }],
    chanelType: 'Offer',
    offerMadeBy: '564545454',
}

I aim to fetch all channels that contain a specific "postID" within this "channel_detail" object. To do so, I'm using the following query:

const sort = { last_message_at: -1 };
let filter = { 'data.channel_detail.postID': { '&eq': postID } };

streamClient.queryChannels(filter, sort, {});

Unfortunately, this query is not returning the expected results. I am not receiving any errors, but the channels with the specified 'postID' are not being retrieved.

Has anyone encountered a similar issue or can provide guidance on how to properly structure a query in React Stream Chat to access custom data within a channel? Any advice or assistance would be greatly appreciated.

0

There are 0 best solutions below