Finding record ID using a field value, Node.js

Hello, I am trying to implement a leaderboard in my game, and am having issues with getting the record ID for a record based on the user’s unique UserID from my base, so I can update that record.

I searched and found this post with 2 different examples, but wasn’t able to adapt them to my use. Here is my code, with the field from my base being “userid” and “recordid” being the variable I want to fill with the Record ID:

const myuseridstring = String(myuserid);

  base('Table 1').select({
    filterByFormula: '{userid} = "${name}"',
    }).eachPage(function page(records, fetchNextPage) {
    
    records.forEach(function(record) {
    console.log('Retrieved record', record.getId('myuseridstring'));
    recordid = record.getId('myuseridstring');
    });
    }, function done(error) {
    });

I appreciate any help, I’ve been stuck on this for a while. Thanks!