|
Our test performing a distinct(nil) operation began failing today with the following message:
Mongo::Error::OperationFailure: FieldPath cannot be constructed with empty string (40352) (on localhost:27017, attempt 1) (on localhost:27017, attempt 1)
This is the line of code that is failing:
... which constructs the following command document:
def distinct(field_name, opts = {})
|
cmd = { :distinct => collection.name,
|
:key => field_name.to_s,
|
:query => filter }
|
The error is generated thusly:
FieldPath::FieldPath(std::string inputPath)
|
: _fieldPath(std::move(inputPath)), _fieldPathDotPosition{string::npos} {
|
uassert(40352, "FieldPath cannot be constructed with empty string", !_fieldPath.empty());
|
uassert(40353, "FieldPath must not end with a '.'.", _fieldPath[_fieldPath.size() - 1] != '.');
|
The error returned by the server to the client/driver should indicate what was wrong in the input provided to the server. In this case, I expect the error to resemble something like "Empty `key` is not allowed with `distinct`", referring to the input provided to the server. The actual error references "FieldPath" which is an internal implementation aspect of the server and not anything a user/application/driver knows.
|