title: Google Firestore Cloud Function - problem with field path
body: <p>I am trying to build cloud firestore scheduled function that select all documents with a certain condition (date less than Date.now) and then to update them one by one in two fields.</p>
  <p>function is deployed successfully but when executed it returns the below error:</p>
  <pre><code>Error: Value for argument &quot;fieldPath&quot; is not a valid field path. Paths can only be specified as strings or via a FieldPath object.
  at Object.validateFieldPath (/workspace/node_modules/@google-cloud/firestore/build/src/path.js:605:15)
  at CollectionReference.where (/workspace/node_modules/@google-cloud/firestore/build/src/reference.js:1059:16)
  at /workspace/index.js:8:12
  at cloudFunction (/workspace/node_modules/firebase-functions/lib/cloud-functions.js:74:23)
  at /layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/function_wrappers.js:144:25
  at processTicksAndRejections (node:internal/process/task_queues:96:5) 
  </code></pre>
  <p>I don't know so much with Java script but I am using the same syntax with flutter code and it is working correctly in the application.</p>
  <p>what is the problem with the below js code?</p>
  <pre><code>const functions = require(&quot;firebase-functions&quot;);
  const admin = require(&quot;firebase-admin&quot;);
  admin.initializeApp();
  const database = admin.firestore();
  exports.testscheduledFunction = functions.pubsub.schedule(&quot;every 1 minutes&quot;).onRun(
        (context) =&gt; {
        database.collection(&quot;BusinessProfilesCollection&quot;)
        .where(&quot;Profile_pinning_ed&quot; &lt; admin.firestore.Timestamp.now())
        .get().then((snapshot) =&gt; {
          let i = 0;
          let tempid = &quot;&quot;;
          console.log(snapshot.docs.length);
          for (i; i&lt;snapshot.docs.length; i++) {
            tempid = snapshot.docs[i].id;
            database.collection(&quot;BusinessProfilesCollection&quot;).doc(tempid)
                .update({
                  &quot;Profile_pinning_status&quot;: &quot;No&quot;,
                  &quot;Profile_pinning_ed&quot;: &quot;&quot;});
          }
        });
    return console.log(
        &quot;Cloud Functions: Business Profiles Pinning is updated successfully&quot;);
  });
  </code></pre>