[SOLVED] Can't _User as Parent to Class (One to Many)

I’m trying to set a one to many relationship between _User class and a new class called “Posts”.
using: “react-moralis”: “^1.3.5”

I’ve tried:

const { user } = useMoralis()
const postObject = useNewMoralisObject('Posts')

const postData = {
    content: 'test post'
    parent: user,
}

await postObject.save(postData, {
    onSuccess: (data) => console.log(data),
    onError: (err) => console.log(err)
})

Output: “Error: schema mismatch for Posts.parent; expected Object but got Pointer<_User>”

how is that column parent in postData table defined?

1 Like

Ahh thank you! I realized what was wrong after reading this. I was testing earlier and the column was defined as an Object instead of a Pointer.

I deleted the class and re ran the code and it works perfect! The column is now a pointer instead of Object

1 Like