I have an employee collection like this
Company.            Ceo.       Employees
Sdr.                Siva.      1-200
Datamatica.         Durga.     200-400
Big.                Mouli.     50-100
After using
db.employee.find({Employees : {$gte : 200}}) 
I don't get any data. The Employees field type is a string.
As japrescott stated, you should split the Employeesfield into two separate fields (employees_from, employees_to) of type Number and then query like this:
db.employee.find({employees_from : {$gte : 200}})
For migration you could use mongo's map reduce to split the current Employees into two separate field and add these to your documents. Afterwards you can delete the Employees field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With