Skip to content

Add support for MongoDB 8.0#711

Merged
pmachapman merged 4 commits intomainfrom
mongodb_8.0
Jul 16, 2025
Merged

Add support for MongoDB 8.0#711
pmachapman merged 4 commits intomainfrom
mongodb_8.0

Conversation

@pmachapman
Copy link
Collaborator

@pmachapman pmachapman commented Jul 2, 2025

This PR updates the MongoDB Driver to 3.4, and Hangfire to 1.8.20, which provides full support for MongoDB 8.0. This PR will still function correctly on MongoDB 6.0 and 7.0, as no 8.0 specific features have been implemented.

This is a pre-requisite for the completion of #682.


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 87.12871% with 13 lines in your changes missing coverage. Please review.

Project coverage is 66.23%. Comparing base (08bd81e) to head (d6a4b13).

Files with missing lines Patch % Lines
...aAccess/src/SIL.DataAccess/DataAccessExtensions.cs 0.00% 6 Missing ⚠️
...ataAccess/src/SIL.DataAccess/MongoUpdateBuilder.cs 83.33% 5 Missing ⚠️
...taAccess/src/SIL.DataAccess/MemoryUpdateBuilder.cs 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #711      +/-   ##
==========================================
- Coverage   66.25%   66.23%   -0.02%     
==========================================
  Files         364      364              
  Lines       19393    19415      +22     
  Branches     2486     2491       +5     
==========================================
+ Hits        12849    12860      +11     
- Misses       5636     5647      +11     
  Partials      908      908              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Enkidu93 Enkidu93 requested review from Enkidu93 and ddaspit July 2, 2025 23:32
Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 24 of 24 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93)


src/DataAccess/src/SIL.DataAccess/IServiceCollectionExtensions.cs line 38 at r1 (raw file):

            var clientSettings = MongoClientSettings.FromConnectionString(connectionString);
            clientSettings.ClusterConfigurator = cb => cb.Subscribe(new DiagnosticsActivityEventSubscriber());
            clientSettings.LinqProvider = LinqProvider.V2;

Yay! I've been wanting to spend the time to get it to work with V3 for a long time.


src/Serval/src/Serval.Translation/Services/EngineService.cs line 486 at r1 (raw file):

                    {
                        if (sourceFiles is not null)
                            u.Set(c => c.Corpora.FirstMatchingElement().SourceFiles, sourceFiles);

I would like to keep the DataAccess library decoupled from Mongo. We should use something defined by the DataAccess library instead of a function defined by the Mongo driver.

Copy link
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 19 of 27 files reviewed, 1 unresolved discussion (waiting on @ddaspit and @Enkidu93)


src/Serval/src/Serval.Translation/Services/EngineService.cs line 486 at r1 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

I would like to keep the DataAccess library decoupled from Mongo. We should use something defined by the DataAccess library instead of a function defined by the Mongo driver.

Done. I wasn't able to use the FieldDefinition as was done in the LINQ2 implementation (because pretty much all of the LINQ3 logic is in public static methods), but I was able to implement a ExpressionVisitor to rewrite the LINQ3 query before it is passed to the Mongo Driver's ExpressionFieldDefinition. Let me know of this approach is OK.

@pmachapman pmachapman requested a review from ddaspit July 9, 2025 00:40
Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 8 of 8 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Enkidu93 and @pmachapman)


src/Serval/src/Serval.Translation/Services/EngineService.cs line 486 at r1 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

Done. I wasn't able to use the FieldDefinition as was done in the LINQ2 implementation (because pretty much all of the LINQ3 logic is in public static methods), but I was able to implement a ExpressionVisitor to rewrite the LINQ3 query before it is passed to the Mongo Driver's ExpressionFieldDefinition. Let me know of this approach is OK.

This is a clever solution. I'm happy with it.

@pmachapman pmachapman merged commit eaff6de into main Jul 16, 2025
2 of 3 checks passed
@pmachapman pmachapman deleted the mongodb_8.0 branch July 16, 2025 00:26
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.

3 participants