mongodb/mongoid · error · ArgumentError
Field must be a string: #{field}
Error message
Field must be a string: #{field} What it means
Error "Field must be a string: #{field}" thrown in mongodb/mongoid.
Source
Thrown at lib/mongoid/criteria/queryable/storable.rb:208
else
selector.store(operator, op_expr)
end
self
end
# Adds an arbitrary expression to the query.
#
# Field can either be a field name or an operator.
#
# Mutates the receiver.
#
# @param [ String ] field Field name or operator name.
# @param [ Object ] value Field value or operator expression.
#
# @return [ Storable ] self.
def add_one_expression(field, value)
raise ArgumentError, "Field must be a string: #{field}" unless field.is_a?(String)
if field.start_with?('$')
add_operator_expression(field, value)
else
add_field_expression(field, value)
end
end
end
end
end
end
View on GitHub (pinned to 0da0e23d71)
When it happens
Trigger: Thrown at lib/mongoid/criteria/queryable/storable.rb:208 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23).
Data as JSON: /api/errors/57dbecc933dfddbe.
Report an issue: GitHub.