Here’s what finally worked. My biggest issue was remembering that Wix renames database fields even when they might be legitimate javascript names. In any case:
import wixData from 'wix-data'; // Used to query database
import wixLocation from 'wix-location'; // Used to get current page URL
import wixUsers from 'wix-users'; // Used to get the current user
$w.onReady(function () {
// Grab the current user's ID
let user = wixUsers.currentUser;
let userId = user.id; // set user ID. could set userId = wixUsers.currentUser.id
let url = wixLocation.url; //current page url
// Should only have to check for the URL matching in the DB, but just to be sure look for user entry
wixData.query("OurDB")
.eq('_id', userId)
.find()
.then( (results) => {
if ((results.items.length === 0) || (results.items[0].fileUrl !== url)) {
wixLocation.to(`/Test/Update/${wixUsers.currentUser.id}`);
//or wixLocation.to('/'); //would send them to home
}
});});