Can't figure out how to filter a dataset by logged-in user

I have been trying to create a table that only shows content that I assign to a member. I need to have the dataset filter by the logged in user.

I have tried this code:
import { currentMember } from “wix-members-frontend”;
import wixData from ‘wix-data’;

$w.onReady(async function () {
const { _id } = await currentMember.getMember();
$w(‘#dataset1’).setFilter(wixData.filter().eq(‘member’, _id))
});

This doesn’t seem to work. I read this post but still can’t get it working.

Would appreciated any help. Thanks!

the code seems to look ok. maybe add some logs to see where the errors may be

import { currentMember } from 'wix-members-frontend';
import wixData from 'wix-data';

$w.onReady(async function () {
    try {
        // Get the current member's ID
        const member = await currentMember.getMember();
        const memberId = member._id;

        console.log("Current member ID:", memberId);

        // Set the filter on the dataset
        $w('#dataset1').setFilter(wixData.filter().eq('member', memberId))
            .then(() => {
                console.log("Filter applied successfully.");
            })
            .catch((error) => {
                console.error("Error applying filter:", error);
            });
    } catch (error) {
        console.error("Error getting current member:", error);
    }
});

I figured it out. I just had to recreate a collection, so it seems like there was an issue with the collection.

Thanks for the response!