Skip to content

VS-128: Fix tests for 2.25 driver #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@
_ = Builders<Person>.IndexKeys.Ascending(new { Field = "Name" }.Field);
_ = Builders<Person>.IndexKeys.Geo2D(new { Field = "TicksSinceBirth" }.Field).Geo2DSphere(new { Field = "Name" }.Field);
_ = Builders<User>.IndexKeys.Text(new { Field = "Age" }.Field).Text(new { Field = "LastName" }.Field);
_ = Builders<Vehicle>.IndexKeys.GeoHaystack(new { Field = "LicenseNumber" }.Field);

Check warning on line 104 in tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersAnonymousObjects.cs

GitHub Actions / build

'IndexKeysDefinitionBuilder<Vehicle>.GeoHaystack(FieldDefinition<Vehicle>, FieldDefinition<Vehicle>)' is obsolete: 'GeoHaystack indexes were deprecated in server version 4.4.'

Check warning on line 104 in tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersAnonymousObjects.cs

GitHub Actions / build

'IndexKeysDefinitionBuilder<Vehicle>.GeoHaystack(FieldDefinition<Vehicle>, FieldDefinition<Vehicle>)' is obsolete: 'GeoHaystack indexes were deprecated in server version 4.4.'
_ = Builders<Person>.IndexKeys.Combine(
Builders<Person>.IndexKeys.Geo2D(new { Field = "Name", IntValue = 10, BoolValue = false, DoubleValue = 2.5 }.Field)
.Geo2D(new { Field = "LastName", IntValue = 10, BoolValue = false, DoubleValue = 2.5 }.Field),
@@ -117,7 +117,8 @@
[BuildersMQL("{ \"Avg\" : { \"$divide\" : [{ \"$add\" : [{ \"$multiply\" : [\"$Age\", 2] }, \"$Height\"] }, 2] }, \"_id\" : 0 }", DriverVersions.V2_19_OrGreater)]
[BuildersMQL("{ new { FieldToExclude = \"Age\" }.FieldToExclude : 0 }")]
[BuildersMQL("{ new { FieldToInclude = \"Scores\" }.FieldToInclude : 1 }")]
[BuildersMQL("{ new { Field = \"IntArray\" }.Field : { \"$slice\" : [10, 5] } }")]
[BuildersMQL("{ new { Field = \"IntArray\" }.Field : { \"$slice\" : [10, 5] } }", DriverVersions.V2_22_OrLower)]
[BuildersMQL("{ new { Field = \"IntArray\" }.Field : { \"$slice\" : [\"$s__0\", 10, 5] } }", DriverVersions.V2_23_OrGreater)]
[BuildersMQL("{ new { Field = \"Age\" }.Field : 1, new { Field = \"LastName\" }.Field : 1 }")]
public void Projection()
{
Original file line number Diff line number Diff line change
@@ -73,8 +73,10 @@ public void Include_exclude()
.Include(u => u.Vehicle).Exclude(u => u.Address);
}

[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [10, 5] } }")]
[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [10, 5] }, \"JaggedStringArray2\" : { \"$slice\" : [3, 9] } }")]
[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [10, 5] } }", DriverVersions.V2_22_OrLower)]
[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [\"$IntArray\", 10, 5] } }", DriverVersions.V2_23_OrGreater)]
[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [10, 5] }, \"JaggedStringArray2\" : { \"$slice\" : [3, 9] } }", DriverVersions.V2_22_OrLower)]
[BuildersMQL("{ \"IntArray\" : { \"$slice\" : [\"$IntArray\", 10, 5] }, \"JaggedStringArray2\" : { \"$slice\" : [\"$JaggedStringArray2\", 3, 9] } }", DriverVersions.V2_23_OrGreater)]
public void Slice()
{
_ = Builders<SimpleTypesArraysHolder>.Projection.Slice(u => u.IntArray, 10, 5);
2 changes: 2 additions & 0 deletions tests/MongoDB.Analyzer.Tests.Common/DriverVersions.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@ public static class DriverVersions
public const string V2_19_OrGreater = "[2.19.0,)";
public const string V2_20_OrLower = "(, 2.20.0)";
public const string V2_21_OrGreater = "[2.21.0,)";
public const string V2_22_OrLower = "(, 2.23.0)";
public const string V2_23_OrGreater = "[2.23.0,)";
public const string V2_19_to_2_20= "[2.19.0, 2.20.0)";
}
}
Original file line number Diff line number Diff line change
@@ -24,7 +24,8 @@ internal static class DriverVersionHelper
NuGetVersion.Parse("2.12.4"),
NuGetVersion.Parse("2.18.0"),
NuGetVersion.Parse("2.19.0"),
NuGetVersion.Parse("2.21.0")
NuGetVersion.Parse("2.21.0"),
NuGetVersion.Parse("2.25.0")
};

public static NuGetVersion[] FilterVersionForRange(string versionRange)

Unchanged files with check annotations Beta

public static readonly long? ReadonlyLongNullable = long.MaxValue;
public static readonly double? ReadonlyDoubleNullable = 234.432;
public static readonly VehicleTypeEnum? ReadonlyEnumNullable = VehicleTypeEnum.Bus;
public static readonly string? ReadonlyStringNullable = "BBB";

Check warning on line 56 in tests/MongoDB.Analyzer.Tests.Common/DataModel/Constants.cs

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 56 in tests/MongoDB.Analyzer.Tests.Common/DataModel/Constants.cs

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 56 in tests/MongoDB.Analyzer.Tests.Common/DataModel/Constants.cs

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
}
}