Problems with collapse and expand

As already mentioned, this code was quick-coded. It is surely not complete.
You will have to expand and optimize it for your own needs.

When you take a look at the code you will find this one…

.eq('expiryDate1')

Now on the second look, i recognise that i have some copy % paste errors, also including errors from your provided version, like mentioned here.

If you take a look onto the Wix-Data-API regarding —> .eq(xxx, xxx)-statement → FILTERING EQUALS SOME VALUE IN SOME SPECIFIC DB-FIELD, you will understand that you have an ERROR in your previous provided code.

And my error was to copy & paste it into my version.

So whats wrong in this mentioned CODE-LINE?

.eq('expiryDate1')

Why this is —> WRONG ???

EXACTLY!!! —> Because …after reading this…

You now understand that you have forget to inculde an important part —> THE VALUE !

RIGHT-VERSION…

.eq(dbField, value)

Now your questions comes into place…

Thank you Ninja but what do the dbField represent? Is it member ID (_id) or is it the field for expiration date of a rented video? :wink:
So you already recognised, that something is missing, or seems to be strange.

EXACTLY!!! —> Let’s correct the code…

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

let date;
//------------USER-INTERFACE---------------------------
const DATABASE = "Rentingmembers";
const dbField = "_owner";
//------------USER-INTERFACE---------------------------
let options = {fieldsets: [ 'FULL' ]};


$w.onReady(function() {
    console.log("Page ready...");
    $w('#dataset5').onReady(async()=>{
        let currentItem = $w("#dataset5").getCurrentItem();
        date = currentItem.expiryDate1;
        
        //------------[ FUNCTION-1 ]--------------
       let currentMemberData = await getCurrentUserData(options);
        console.log("Found MEMBER  -->" + " / "+currentMemberData);
        let userID = currentMemberData[0]._id;
        console.log(userID);
        
        //------------[ FUNCTION-2 ]--------------
        let items = await getDataFromDB(userID);
        console.log("Found ITEMS  -->" + " / " + items);    
    });    
});
//------------


function getCurrentUserData(options) {
    currentMember.getMember(options)
    .then((member) => {
        const id = member._id;
        console.log("ID: ", id);
        const fullName = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
        console.log("Fullname: ", fullName);
        return member;
    }).catch((error) => {console.error(error);});   
}
//------------


function getDataFromDB(userID) {
    wixData.query(DATABASE)
    .eq(dbField, userID).find()
    .then((results) => {
        if (results.length > 0 ) {
           console.log("Some-Data found!");
           console.log("Got results 4 specific OWNER-ID.");
           console.log(results);
           console.log(results.items);
           console.log(results.items[0]);
           console.log(results.items[0].title);
           console.log(results.items[0].expiryDate1);
           //----------------------
           return results.items;           
        }
        else {console.log("No DATA found!!!");}
    }); 
}
//------------

So as you can see, you again are mixing everything together.
-using Wix-Data together with DATASET (not waiting for DATASET to be → READY <—).
-mixing get and query.
-using old depricated API.

Start to use the —> CONSOLE <— —> to be able to understand your own code.

But i think your code is still not complete. Modify the code by your own further needs.