Hi all,
We need to switch to subtype 4 for UUID. There is a large collection and most UUIDs has subtype 3.
We followed this recommendation from this post
- For small data, create a new collection, migrate data, ensure GUIDs use subtype 4;
- For large collections, use a custom IBsonSerializer that reads subtype 3 and 4, but always writes as subtype 4.
So, we created a custom serializer and it works as expected.
`
BsonDefaults.GuidRepresentationMode = GuidRepresentationMode.V3;
BsonSerializer.RegisterSerializer(new GuidAdaptiveSerializer());
BsonSerializer.RegisterSerializer(new NullableGuidAdaptiveSerializer());
`
But how can we filter the data by ignoring subtypes?
for old items this doesn’t work:
var filter = Builders<UserModel>.Filter.Eq("_id", "158d268a-5956-4455-bb68-74ae2ed49b2e");
var item = collection.Find(filter).FirstOrDefault();