#How to query 2 "where"?

1 messages · Page 1 of 1 (latest)

mortal notch
#

this does not work

        const query = qs.stringify(
            {
                where: {
                    "site.domain": {
                        equals: site
                    },
                    "locales.locales": {
                        equals: locales
                    }
                },
                depth,
                limit,
                page,
                sort
            },
            {
                skipNulls: true,
                addQueryPrefix: true,
                encode: true
            }
        );

        const result = await this.get(`blogs${query}`);
weak harnessBOT
mortal notch
#

this does not work too

        const query = qs.stringify(
            {
                where: {
                    and: [
                        {
                            "site.domain": {
                                equals: site
                            },

                        },
                        {
                            "locales.locales": {
                                equals: locales
                            }
                        }
                    ]
                },
                depth,
                limit,
                page,
                sort
            },
            {
                skipNulls: true,
                addQueryPrefix: true,
                encode: false
            }
        );

        const result = await this.get(`blogs${query}`);
#

"ApolloError","message":"500: Internal Server Error","stack":"Error: 500: Internal Server Error"

#

note i extend this as RESTDatasource

mortal notch
#

somehow this works

        const query = qs.stringify(
            {
                where: {
                    "site.domain": {
                        equals: site
                    },
                    "locales.locales": {
                        equals: locales[0]
                    }

                },
                depth,
                limit,
                page,
                sort,
            },
            {
                skipNulls: true,
                addQueryPrefix: true,
                encode: false
            }
        );

        const result = await this.get(`blogs${query}`);
#

but yeah - how can we use and here? not sure above code - cause it might return the docs if 1 param fulfills it