I am using ruby on rails with MongoDB. I have one field 'possession' as string type field. I've updated it as 'Integer'. 

Now, I want to find old data with specific string(for example, '6') and need to update all as integer values(means 6).

So, instead of doing each loop on all record I will just distinct values and update\_all based on distinct values.

Please let me know if anyone has idea about this.