Skip to content

Commit e95c7ca

Browse files
committed
fix(mongodb): add warning about 'language' field in MongoDB text search
- Added a comment with a link to explain the issue with 'language' field in MongoDB text search - This change prevents potential conflicts with MongoDB's reserved keyword
1 parent 3fab26e commit e95c7ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/src/data_mongodb.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class DataMongodb<T> implements DataClient<T> {
9090
/// conflicts with a reserved keyword in MongoDB's `text` search options.
9191
/// To prevent this, it transparently renames any 'language' field to
9292
/// 'modelLanguage' before the document is written.
93+
///
94+
/// https://www.mongodb.com/community/forums/t/just-to-point-out-do-not-name-a-field-language-if-you-are-planning-to-create-an-index/263793
9395
Map<String, dynamic> _transformMapForDb(Map<String, dynamic> map) {
9496
if (map.containsKey('language')) {
9597
final newMap = Map<String, dynamic>.from(map);

0 commit comments

Comments
 (0)