title: How to add a id filter in the Strapi call in a nested object?
body: <p>I am trying to send an API get request to Strapi with filter as per below:</p>
  <pre><code> let filter = {
      ...cleanObject({
        action_contains: inputValues?.action?.value || null,
        condition_contains: inputValues?.condition?.value || null,
        category_contains: inputValues?.category?.value || null,
        'country.id': inputValues?.country || null,
        'state.id': inputValues?.state || null,
        'city.id': inputValues?.city || null,
       }
  </code></pre>
  <p>Where <code>cleanObject</code> equals</p>
  <pre><code>function cleanObject(obj) {
    let propNames = Object.getOwnPropertyNames(obj);
    for (let i = 0; i &lt; propNames.length; i++) {
      var propName = propNames[i];
      if (obj[propName] === null || obj[propName] === undefined) {
        delete obj[propName];
      }
    }
    return obj;
  }
  </code></pre>
  <p>The filter then is used later with <code>axios</code> which is calling to Strapi</p>
  <pre><code>  async FIND(filter) {
      try {
        let query
        if (filter) {
          query = qs.stringify(filter)
        }
        let endpoint = `${this.apiEnpoint}${this.service}${query ? `?${query}` : ''}`
        let { data } = await axios.get(endpoint,
          {
            headers: this.headers(this.getToken())
          })
        return { data }
      } catch (error) {
        return { error: this.getErrorMessage(error) }
      }
    }
  </code></pre>
  <p>The issue which I am facing is that on Strapi I have the following component:</p>
  <pre><code>  &quot;address&quot;: {
        &quot;type&quot;: &quot;component&quot;,
        &quot;repeatable&quot;: false,
        &quot;component&quot;: &quot;address.address&quot;
      },
  </code></pre>
  <p>And the component properties areas:</p>
  <pre><code>{
    &quot;collectionName&quot;: &quot;components_address_addresses&quot;,
    &quot;info&quot;: {
      &quot;name&quot;: &quot;address&quot;,
      &quot;icon&quot;: &quot;address-book&quot;,
      &quot;description&quot;: &quot;&quot;
    },
    &quot;options&quot;: {},
    &quot;attributes&quot;: {
      &quot;country&quot;: {
        &quot;model&quot;: &quot;country&quot;
      },
      &quot;state&quot;: {
        &quot;model&quot;: &quot;state&quot;
      },
      &quot;city&quot;: {
        &quot;model&quot;: &quot;city&quot;
      },
      &quot;fullAddress&quot;: {
        &quot;type&quot;: &quot;string&quot;
      },
      &quot;zipCode&quot;: {
        &quot;type&quot;: &quot;string&quot;
      }
    }
  }
  </code></pre>
  <p>Problem:</p>
  <ol>
  <li><p>If I use <code>action_contains: inputValues?.action?.value || null,</code> this generates the query and gets back the results I expect.</p>
  </li>
  <li><p>The part which does not work, I cannot access the <code>country.id</code> in the inner object, and not sure what would be the approach for a nested object. When I am sending this to the API Endpoint I am getting back the response:</p>
  <p>{
  &quot;statusCode&quot;: 400,
  &quot;error&quot;: &quot;Bad Request&quot;,
  &quot;message&quot;: &quot;Your filters contain a field 'country.id' that doesn't
  appear on your model definition nor it's relations&quot;
  }</p>
  </li>
  </ol>
  <p>The API call itself looks like this:</p>
  <p><code>http://localhost:8080/real-estate-listings/count?_where%5Bcountry.id%5D=602e0e07dd3e24308f9f1fb0</code></p>
  <p>What I have tried:
  I tried to add the <code>'country.id': inputValues?.country || null,</code> to several combinations like <code>address.country.id</code>, replacing dot with ?, adding _eq in the end of it. Tried to Read Strapi Documentation, which confused me a bit more.</p>
  <p><strong>Question:</strong>
  How should I change the API call in order for me to filter by the country id in the object nested element?</p>
  <p>Note: The full code is much larger, so only parts that I see related have been provided. I hope that is enough.</p>
  <p>Technologies used: MongoDb, Next.js, Strapi.</p>