[DRIVERS-2210] Fix server version incompatibility for updateOne-let and updateMany-let server-side error tests Created: 16/Feb/22 Updated: 14/Apr/23 Resolved: 14/Apr/23 |
|
| Status: | Closed |
| Project: | Drivers |
| Component/s: | CRUD |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeremy Mikola | Assignee: | Dmitry Rybakov |
| Resolution: | Done | Votes: | 0 |
| Labels: | yaml-test | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Changes: | Needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Downstream Changes Summary: | The minServerVersion was updated for some test cases in the updateOne-let and updateMany-let CRUD spec tests. Drivers should sync CRUD spec tests to mongodb/specifications@4a8ac5f. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Compliance: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
bailey.pearson observed that the updateOne-let.yml and updateMany-let.yml tests introduced in mongodb/specifications@1519da9 for DRIVERS-1788 use pipeline-style updates (4.2+) despite the tests specifying a minServerVersion of 3.6.0. These tests should either have minServerVersion bumped to 4.2.0 or be changed to not use pipeline-style updates. Per the docs examples in Use Variables in let Option or c Field, it looks like we can reference bound variables in the update's query by using $expr to access the aggregation context. This should be portable for pre-4.2 servers if we'd rather not bump the minServerVersion. AFAIK, $expr cannot be used in a non-pipeline update, so we'd need to require 4.2+ if we still want to access the bond variables from the update itself (i.e. u parameter). |
| Comments |
| Comment by Dmitry Rybakov [ 17/Feb/22 ] | |||||||
|
jmikola replaceOne-let.yml should be fine. It does not use pipeline for update, only for filter. So, a proper error is raised by the server here. I tested against 3.6.23:
We can raise minServerVersion to be 100% safe, but the existing test should work properly. | |||||||
| Comment by Jeremy Mikola [ 16/Feb/22 ] | |||||||
|
dmitry.rybakov: Are we sure that replaceOne-let.yml didn't also need to be changed? I see it uses errorContains for the server-side error assertion, so perhaps not. Just thought of this while reviewing mongodb/specifications#1132 for DRIVERS-2183. | |||||||
| Comment by Githook User [ 16/Feb/22 ] | |||||||
|
Author: {'name': 'Dmitry Rybakov', 'email': 'dmitry.rybakov@mongodb.com', 'username': 'comandeo'}Message: | |||||||
| Comment by Jeremy Mikola [ 16/Feb/22 ] | |||||||
| Comment by Dmitry Rybakov [ 16/Feb/22 ] | |||||||
|
The buggy test still may pass on some driver because the error thrown by server depends on order of field in update command:
|