Can someone tell me why my user is not being updated?

I am trying to make a cloud function that creates a notification object and adds it to the user’s list of UnreadNotifications. Here is the code for that:

Moralis.Cloud.define('sendNotificationToUser', async (request) => {
	const query = new Moralis.Query('User')
    const ethAddress = request.params.address.toLowerCase()
    query.equalTo('ethAddress', ethAddress)
  	const result = await query.find({ useMasterKey: true })
    const user = result[0]
    const NotificationCatalog = Moralis.Object.extend('NotificationCatalog')
    const notificationObject = new NotificationCatalog()
    const unreadNotifications = user.get('UnreadNotifications')
  	user.set('UnreadNotifications', unreadNotifications)

It does not work as expected though. The notification does get successfully created in the database on this line:


But the user’s UnreadNotifications never gets updated, it remains empty. Can someone tell me why this is? Do I need to use master key again somewhere?

Here you can try to use master key with, {})