Inserting User Name From PrivateMembers into collection

I want to insert member’s name into collection but its not working, the input that inserted to the collection is object promise. how to convert to string?

this is the output:

please help

You are receiving this output because it is a promise. You should use “await” in this context. You should create a const/let called member details = await getMemberName(userId). Something like this:

let userId = getUserId() //your fn here
let memberDetails = await getMemberName(userId)
let toInsert = {
    fullName: memberDetails?.toString() ?? '' //returns member name or empty string
    //your code here