Why is the query returning an empty array?

What am I missing?

const data = await builder
      .getAll(model, {
        query: {
          data: {
            $and: [
              { topic: { id: { $eq: "something..." } } },
              { lang: { $eq: "ar" } },
            ],
          },
        },
      })

Hi, how are you @ali-builder ?
I’m not familiar with builder.io yet. But in mongodb, when you use $eq, you need to specify an expression, like:

$eq: [ "$lang", "ar" ]

This will compare lang with his value, if is ar, will return true.

For another topic, what are you wanting to get?

Hi @matheusnogueira
unfortunately, the syntax you referred to didn’t work.
But I tried to change my query for the topic.

// it works
{ "topic.id": { $eq: "..." } }

// it doesn't work 
{ "topic": { id: { $eq: "..." } } }

2 Likes