Invalid Schema with Inverse Relationship on One-To-Many Side

Hello, I am referencing this article: https://docs.mongodb.com/realm/sdk/node/examples/define-a-realm-object-model/#define-an-inverse-relationship-property

The example in the article puts the backlink on the Many-to-One side of the relationship. I.e. you define per User which Tasks belong to it, and then each Task has a backlinked User. Being new to the NoSQL paradigm, I am used to the opposite. I would take each Task and assign it a User. There would then be a backlinked list (or better, set) of Tasks on each User.

Is this possible, or am I thinking about this the wrong way? If it’s possible, what is the proper syntax to define the schema? Here’s a snippet of what I’ve tried (within the inverse relationship part within the User schema):

assignee: {
    type: "linkingObjects",
    objectType: "Task<>",
    property: "user"
}

and a snippet of the Task schema:

user: "User"

I get a schema validation error: “- Property ‘User.assignee’ of type ‘linking objects’ has unknown object type ‘Task<>’”

Thanks!

Bumping this - I’d appreciate any wisdom.

Angle brackets, <>, are mostly used by TypeScript to denote types for generic classes. But I am guessing here you were not dealing with TS. But, actually, the code is part of the schema and this would be the wrong move, hence the error unknown object type ‘Task<>’

Following the examples just a page below in the link you supplied, your code should be without any brackets:

objectType: "Task"

Or maybe you had an array in mind, but that requires square brackets, []. You haven’t supplied more of your code, so checking this is in on you :wink: