We are using MongoDBMembershipStrategy.Muiltiple and noticed that we have a large number of defunct entries accumulating in the membership table which aren't getting cleaned-up as expected.
I believe this is related to DateTime vs. DateTimeOffset issues in the DeleteManyAsync call.
x.Timestamp is a DateTime while beforeDate is a DateTimeOffset. The comparison between the two results in an implicit conversion to DateTimeOffset and a query filter like this being generated:
Zero results will be returned by this query because the DateTimeOffset is being converted to an array which cannot be compared against the date-formatted Timestamp field.
We are using
MongoDBMembershipStrategy.Muiltiple
and noticed that we have a large number of defunct entries accumulating in the membership table which aren't getting cleaned-up as expected.I believe this is related to DateTime vs. DateTimeOffset issues in the
DeleteManyAsync
call.https://github.com/OrleansContrib/Orleans.Providers.MongoDB/blob/22bc56b54b9407453116d9f2294700e40992bdb4/Orleans.Providers.MongoDB/Membership/Store/Multiple/MultipleMembershipCollection.cs#L177-L180
x.Timestamp
is a DateTime whilebeforeDate
is a DateTimeOffset. The comparison between the two results in an implicit conversion toDateTimeOffset
and a query filter like this being generated:{{ "DeploymentId" : "My-Deployment-Id", "Status" : 6, "Timestamp" : { "$lt" : [NumberLong("637852876860000000"), 0] } }}
Zero results will be returned by this query because the
DateTimeOffset
is being converted to an array which cannot be compared against the date-formattedTimestamp
field.