Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

scala.collection.immutable.List out of VALUE_STRING when query with List[String] for multi-valued param

20 views
Skip to first unread message

Yusa Liu

unread,
May 2, 2023, 4:25:04 AM5/2/23
to ReactiveMongo - http://reactivemongo.org
Sorry to post in issue tracker earlier, I met a problem when trying to create an API with multi-valued parameter (in same key), following link is the details:


Thanks for reading this question.

Cédric Chantepie

unread,
May 2, 2023, 12:16:36 PM5/2/23
to ReactiveMongo - http://reactivemongo.org
As suggested on the issue tracker, you should first share a reproducer focused on the ReactiveMongo use, without all the stack around that could introduce issues for so many reasons.

Carlos Saltos

unread,
May 3, 2023, 12:14:35 AM5/3/23
to reacti...@googlegroups.com
Creating a custom reader and writer should help, with them you can do any crazy combination you need.

Here you may find a gist with a sample code about it -> https://gist.github.com/csaltos/c6ce2ae355d82af5ee1afe95465f0323

Then you can import the converter writer and reader in your code and call MongoDB operations with automatic conversion.

To activate the automatic conversion, import the wirter and reader with something like `import AddressConverter._` in your code.

The sample is only as a reference and there is a lot of ways to customize them, with exceptions, without exceptions, using lists, options, strict values for everything, etc.

I hope this helps.

Best regards,

Carlos

--
You received this message because you are subscribed to the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reactivemong...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reactivemongo/5a4e1f12-31c4-4709-ac9f-fe07740d7dacn%40googlegroups.com.

Yusa Liu

unread,
May 3, 2023, 5:38:08 AM5/3/23
to ReactiveMongo - http://reactivemongo.org
Hi,

Thanks for replying,

Finally I found that the issue is due to the Option[] type for multiValue class I set for query params.

I fixed it by changing the type to List[String] = Nil, and then it passed.

Still appreciate for the kind suggestions, the examples helped me to understanding the how it worked underneath.

Best,

Yusa

csa...@gmail.com 在 2023年5月3日 星期三中午12:14:35 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages