Reputation: 157
How to add one to many relations in parse pointer, please check this screenshot:
It's a pointer and i can only add one pointer per row (one-to-one) i cant add one to many relationship to this using js it throws error.
{"code":111,"error":"invalid type for key members, expected *_User, but got array"}
And I don't wanna use parse 'Relation' type column due to querying 'Relation' is complicated.
Upvotes: 0
Views: 891
Reputation: 1436
If you want to have multiple-pointer column, just create array column and fill it with _User
objects. Result will look like this and it will really be array of pointers:
[{"__type":"Pointer","className":"_User","objectId":"kIg9Kzzls9"},
{"__type":"Pointer","className":"_User","objectId":"TGCBZm52zW"},
{"__type":"Pointer","className":"_User","objectId":"YfGT9GvJs6"}]
Using include
to get full objects in query also works, it is an array of pointers.
Upvotes: 2
Reputation: 114
I have bump into this error before.
It is because the <Type>
of your member
column is already automatically set to *_User
. If you try to set a many to many relation into the same column, it just don't work since the type are different.
You can solve the issue by manually deleting the column in your dashboard and set it in your code again.
Upvotes: 1