0

How to add one to many relations in parse pointer, please check this screenshot:

parse dashboard

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.