Skip to content

Conversation

@lomesh2312
Copy link

Fixes #15848

Changes

This PR fixes two bugs:

1. Fixed typo in lib/schema/operators/text.js

  • Changed '.$castSensitive' to '.$caseSensitive' on line 31
  • Ensures error messages correctly reference the $caseSensitive field

2. Fixed variable reference bug in lib/cast/double.js

  • Changed BSON.Double.fromString(val) to BSON.Double.fromString(tempVal) on line 37
  • When casting objects with valueOf()/toString() methods, the extracted string value should be used instead of the original object

Testing

All existing tests pass:

  • ✅ 3968 tests passing
  • ✅ Text search tests verified
  • ✅ No regressions introduced

Diff Summary

lib/schema/operators/text.js:

- path + '.$castSensitive');
+ path + '.$caseSensitive');

lib/cast/double.js:

- coercedVal = BSON.Double.fromString(val);
+ coercedVal = BSON.Double.fromString(tempVal);

- Fix typo in lib/schema/operators/text.js: '' -> ''
  This ensures error messages correctly reference the  field

- Fix variable reference bug in lib/cast/double.js: use 'tempVal' instead of 'val'
  When casting objects with valueOf()/toString() methods, the extracted string
  value should be used instead of the original object
@vkarpov15 vkarpov15 added this to the 9.0.1 milestone Dec 2, 2025
@vkarpov15 vkarpov15 merged commit 50618fd into Automattic:master Dec 2, 2025
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix typo in text search error path and variable bug in double casting

2 participants