docs: function setupCommand(bson, ns, cmd, cursorState, topology, options) {
    // Set empty options object
    options = options || {};
    // Get the readPreference
    const readPreference = getReadPreference(cmd, options);
  
    // Final query
    let finalCmd = {};
    for (let name in cmd) {
      finalCmd[name] = cmd[name];
    }
  
    // Build command namespace
    const parts = ns.split(/\./);
  
    // Serialize functions
    const serializeFunctions =
      typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
  
    // Set up the serialize and ignoreUndefined fields
    const ignoreUndefined =
      typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : false;
  
    // We have a Mongos topology, check if we need to add a readPreference
    if (topology.type === 'mongos' && readPreference && readPreference.preference !== 'primary') {
      finalCmd = {
        $query: finalCmd,
        $readPreference: readPreference.toJSON()
      };
    }
  
    // optionally decorate query with transaction data
    const err = decorateWithSessionsData(finalCmd, options.session, options);
    if (err) {
      return err;
    }
  
    // Build Query object
    const query = new Query(bson, `${parts.shift()}.$cmd`, finalCmd, {
      numberToSkip: 0,
      numberToReturn: -1,
      checkKeys: false,
      serializeFunctions: serializeFunctions,
      ignoreUndefined: ignoreUndefined
    });
  
    // Set query flags
    query.slaveOk = readPreference.slaveOk();
  
    // Return the query
    return query;
  }