JavaScript in Mongo queries (string -> float)

Hi,

I have connected Metabase to a MongoDB instance and for the most part it covers our needs beautifully.

However, our application stores some numbers as strings (we are using mongoid in a Ruby app). Due to this we can’t perform operations on these fields in Metabase (like sum or avg).

I’ve been thinking about how to solve this. The obvious one is to store an additional field on each document which is of type Float instead of BigDecimal. This however clutters our application code.

MongoDB might have something like type casting coming, but highly unclear right now.

That’s why I was thinking about using mapReduce with custom js that performs the type conversion.

But right now it seems like I am limited to aggregation pipelines in Metabase? Has anyone managed to use mapReduce with Metabase?

Any other ideas on how to move around this problem?

Cheers,
Carl