Skip to content

CSHARP-4938: Support for indexing and querying on UUID and null datatype #1563

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 10 commits into from
Dec 4, 2024

Conversation

papafe
Copy link
Contributor

@papafe papafe commented Dec 3, 2024

No description provided.

@papafe papafe marked this pull request as ready for review December 3, 2024 13:41
@papafe papafe requested a review from a team as a code owner December 3, 2024 13:41
new EqualsSearchDefinition<TDocument, TField>(path, value, score);

/// <summary>
/// Creates a search definition that queries for documents where an indexed field is equal
/// to the specified value.
/// Supported value types are boolean, numeric, ObjectId and date.
/// Supported value types are null, boolean, numeric, ObjectId, Guid and date.
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add the Guid comment also to In operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just did

[BsonElement("testString")]
public string TestString { get; set; }

[BsonGuidRepresentation(GuidRepresentation.Standard)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the extra line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to have both attributes on one line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry it's all good, on the smaller laptop screen it seemed like there is an extra empty line.

@@ -302,12 +302,14 @@ public void Equals_should_render_supported_type<T>(
new object[] { (double)1, "1", Exp(p => p.Double), nameof(Person.Double) },
new object[] { DateTime.MinValue, "ISODate(\"0001-01-01T00:00:00Z\")", Exp(p => p.Birthday), "dob" },
new object[] { DateTimeOffset.MaxValue, "ISODate(\"9999-12-31T23:59:59.999Z\")", Exp(p => p.DateTimeOffset), nameof(Person.DateTimeOffset) },
new object[] { ObjectId.Empty, "{ $oid: '000000000000000000000000' }", Exp(p => p.Id), "_id" }
new object[] { ObjectId.Empty, "{ $oid: '000000000000000000000000' }", Exp(p => p.Id), "_id" },
new object[] { Guid.Empty, """{ "$binary" : { "base64" : "AAAAAAAAAAAAAAAAAAAAAA==", "subType" : "04" } }""", Exp(p => p.Guid), nameof(Person.Guid) },
Copy link
Contributor

Choose a reason for hiding this comment

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

'Raw string literals', nice feature! TIL

Copy link
Contributor

@adelinowona adelinowona left a comment

Choose a reason for hiding this comment

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

LGTM except for one comment

Copy link
Contributor

@BorisDog BorisDog left a comment

Choose a reason for hiding this comment

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

LGTM! + Last minor comment about to update the In doc.

[BsonElement("testString")]
public string TestString { get; set; }

[BsonGuidRepresentation(GuidRepresentation.Standard)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry it's all good, on the smaller laptop screen it seemed like there is an extra empty line.

@@ -122,13 +122,13 @@ public SearchDefinition<TDocument> Equals<TField>(
FieldDefinition<TDocument, TField> path,
TField value,
SearchScoreDefinition<TDocument> score = null)
where TField : struct, IComparable<TField> =>
where TField : IComparable<TField> =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this IComparable constraint as well? Looking at the code path we don't do any comparing ourselves, we just render the value in the search stage. I actually don't see a benefit for us if we are not doing the comparing. I tried testing removing all the type constraints here, and everything still works and evergreen doesn't report any breaking changes. Thoughts? @BorisDog

Copy link
Contributor Author

@papafe papafe Dec 4, 2024

Choose a reason for hiding this comment

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

I agree that this can be removed safely and just did it.

@papafe
Copy link
Contributor Author

papafe commented Dec 4, 2024

Just added the test collections on the common cluster. Waiting for the CI to be green and then I'll merge

@papafe papafe merged commit de3adba into mongodb:main Dec 4, 2024
27 of 30 checks passed
@papafe papafe deleted the csharp4938 branch December 4, 2024 21:39
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