In my Rails app I am using MongoID with a Elasticsearch river for text search.
For @devices_with_config = ConfigTextSearch.search params[:device_id]
I want to extract just the device_id
fields for the matching records in the query. In mongoID 3.1.0
I could just use Band.all.pluck(:name)
. But unfortunately, I am stuck with 3.0.23.
I see there is a similar moped expression collections[:bands].find.select(name: 1)
...but I am new to rails and can't figure out how I would use a moped expression in a controller or model.
Any Ideas on how I can just extract the 'device_id' field in matches with MongoId?