@aeroengineerz7
Hello again
i did not forget you.
I have prepared an example for you, which could help you out of your problem-situation.
Try to understand the following CODE… (it could be the key to your SOLUTION)
import wixData from 'wix-data';
import wixUsers from 'wix-users';
$w.onReady(async function () {console.log("START")
let userID = wixUsers.currentUser.id
console.log(await get_Owner(userID))
let DATA = await get_Owner(userID)
console.log("User-ID: ----> " + DATA._id)
console.log("Owner-ID: ---> " + DATA._owner)
})
async function get_Owner (userID) {
return wixData.query("Comments2")
.eq("_owner", userID)
.find()
.then((results) => {
let dataLength = results.items.length
console.log(dataLength)
if(results.items.length > 0) {
let firstItem = results.items[0];
let userComments = []
let userPics = []
for (var i = 0; i < dataLength; i++) {
userComments.push(results.items[i].comment)
userPics.push(results.items[i].userPic)
}
return [firstItem, userComments, userPics]
}
else { }
console.log("END")
} )
.catch( (err) => {
let errorMsg = err;
} );
}
What does this code do ?
It searches for all commets and pics of the current logged-in-user.
You will get results like this when you take a look into console…
![]()
And when you open the results…
You probably will recognize, that it is the chat-history
This little CODE should give you the idea, how to solve your problem!
For better understanding, here the related 2x DATABASES (“Comments2” & “Member-Data”)
Good luck and happy CODING.
And do not forget to like it if you really liked it ![]()



