Skip to content

CSHARP-4528: Extend Search.Equals to support number and date #1043

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 4 commits into from
Mar 22, 2023

Conversation

BorisDog
Copy link
Contributor

No description provided.

@BorisDog BorisDog requested a review from JamesKovacs March 20, 2023 19:38
Copy link
Contributor

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

Spelling correction and minor question. Overall looks good.

}

[Fact]
public void Equals_typed()
public static object[][] EqualsSupporteddTypesTestData => new[]
Copy link
Contributor

Choose a reason for hiding this comment

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

EqualsSupporteddTypesTestData => EqualsSupportedTypesTestData
(extra "d" in the middle)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done.

long v => (BsonInt64)v,
float v => (BsonDouble)v,
double v => (BsonDouble)v,
DateTime v => (BsonDateTime)v,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we support DateTimeOffset too?

Copy link
Contributor Author

@BorisDog BorisDog Mar 21, 2023

Choose a reason for hiding this comment

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

We can. We don't have a direct implicit conversion to BsonDateTime, so not sure how best to account for offset in this case.
Maybe we can consider support for DateTimeOffset both for Equals and Range in a separate ticket?

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that BsonDateTime stores the date in UTC, we can do something like this:
DateTimeOffset v => (BsonDateTime)v.UtcDateTime,

We would also need to add tests.

@BorisDog BorisDog requested a review from JamesKovacs March 21, 2023 23:41
Copy link
Contributor

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

LGTM

@BorisDog BorisDog merged commit 79cfcc0 into mongodb:master Mar 22, 2023
@BorisDog BorisDog deleted the csharp4528 branch March 22, 2023 18:15
DmitryLukyanov pushed a commit that referenced this pull request Mar 24, 2023
dnickless pushed a commit to dnickless/mongo-csharp-driver that referenced this pull request Aug 24, 2023
…#1043)

* CSHARP-4528: Extend Search.Equals to support number and date
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.

2 participants