title: Unable to use firebase documentId() in node js admin sdk (firebase-admin npm package grammar issue)
body: <p>My database looks like:</p>
  <pre><code>db-dev
     user-metadata
         portfolios
              meta
                 pending
                         userId
                                events-collection
                                             doc1
                                             doc2
                                             ...
                         userId2
                                events-collection
                                             doc1
                                             doc2
                                             ...
                 verified
                         userId
                                events-collection
                                             doc1
                                             doc2
                                             ...
                         userId2
                                events-collection
                                             doc1
                                             doc2
                                             ...
                         
  </code></pre>
  <p>I want to fetch all docs that belong to verified events-collection. Following this <a href="https://stackoverflow.com/questions/68049541/collectiongroupquery-but-limit-search-to-subcollections-under-a-particular-docum/68049847#68049847">answer</a> and this <a href="https://medium.com/firebase-developers/how-to-query-collections-in-firestore-under-a-certain-path-6a0d686cebd2" rel="nofollow noreferrer">Blog Post</a> I tried to do the following:</p>
  <pre><code>export const getVerifiedEvents = async (eventType: DocumentType) =&gt; {
    //eventType is either pending or verified
    const rootRef = Server.db.collection(
      `${constDocumentRefs.merchants_meta_loc}/${eventType}`
    );
  
    const documents = await const documents = await Server.db
      .collectionGroup('events-collection')
      .orderBy(documentId())
      .startAt(rootRef.path)
      .endAt(rootRef.path + '\uf8ff')
      .get();
    return documents.docs.map((doc) =&gt; doc.data());
  };
  </code></pre>
  <p>But the above code throws me the following error:</p>
  <pre><code>TypeError: Cannot read properties of undefined (reading 'documentId')
    13 |   const documents = await Server.db
    14 |     .collectionGroup('events-collection')
  &gt; 15 |     .orderBy(firestore.documentId())
       |             ^
    16 |     .startAt(rootRef.path)
    17 |     .endAt(rootRef.path + '\uf8ff')
    18 |     .get();
  </code></pre>
  <p>Here's how my Server instance looks like:</p>
  <pre><code>import { auth, db, storage } from './firebase_server';
  
  const firebaseServer = {
    auth,
    db,
    storage,
  };
  
  export default firebaseServer;
  </code></pre>
  <p>Where auth,db and storage are imported from following files:</p>
  <pre><code>import admin from 'firebase-admin';
  
  const keyString = process.env.FB_ADMIN_PRIVATE_KEY ?? '{&quot;privateKey&quot;: &quot;&quot;}';
  
  const { privateKey } = JSON.parse(keyString);
  
  if (privateKey === '') {
    console.log('FIREBASE_PRIVATE_KEY is not set');
  }
  
  if (admin.apps.length === 0)
    admin.initializeApp({
      credential: admin.credential.cert({
        clientEmail: process.env.FB_ADMIN_CLIENT_EMAIL,
        privateKey: privateKey,
        projectId: process.env.FB_ADMIN_PROJECT_ID,
      }),
    });
  
  const db = admin.firestore();
  const auth = admin.auth();
  const storage = admin.storage();
  
  export { auth, db, storage };
  </code></pre>
  <p>To be precise, I am using <code>firebase-admin</code> [&quot;firebase-admin&quot;: &quot;^10.0.1&quot;] npm package and this is just not working whereas in lots of places they have been directly using documentId() with ease. What's the correct grammar for the same?</p>