Property conversion from String to Int & vice versa

I want to apply join using Id (which is Int) and values (which is String). Join operation will only get successful if values get converted from string to Int. How to do it?

The best solution would be to change your document schema so values is an int. (Actually the very best solution is to use the document ID instead of a custom Id property – it’ll make your docs smaller and save you from having to create an index on Id. Also the document ID is guaranteed to be unique, whereas a property value isn’t.)

If you can’t do that … we don’t have a CAST operator, unfortunately (that seems like a mistake; I’ll file an issue to add it in the future.) But you should be able to make values into an int with the expression values + 0 … the addition operator will cast both sides to numbers.

1 Like

I filed an issue here.

1 Like