-
Notifications
You must be signed in to change notification settings - Fork 84
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
CosmosDB UUID issue #7
Comments
Hello, The IMongoDbContext of the repository exposes the following method:
Allowing you set the guidRepresentation to whatever is needed for your application. If you don't want to modify the global setting BsonDefaults.GuidRepresentation, you can specify the setting when you create your collection:
Then any GUIDs written to the collection will be in the standard format. Note that when you read records from the database, you will get a System.FormatException if the GUID format in the database is different from the format in your collection settings. |
Yes, it is a bug in CosmosDB. I got rid of your repository (because of the static constructor) and use CSharpLegacy type. Otherwise, it won't work. I encourage you to remove the static constructor. |
Thanks for the feedback, I'll look into removing the static constructor.
According to https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver/MongoDefaults.cs, it should not cause issues:
|
It is not causing an issue with MongoDB, but rather with CosmosDB with mongo wire protocol. |
Using |
yeah it does. I've also removed the static constructor in the last version of the repo ;) |
I'm still having trouble with this and can't seem to get the document records to show up in Azure Cosmos DB. Could you please elaborate on how the override is used and where it needs to be instantiated? Also, do I need to make some changes to the Startup or anything around the Document to associate to the user? |
I also can't get the docs to show up in CosmosDB. I'm getting this error: "Error querying documents: The GuidRepresentation for the reader is CSharpLegacy, which requires the binary sub type to be UuidLegacy, not UuidStandard" I tried below code, but it's not working:
|
Hi,
I'm currently facing issue with UUID 04 representation in CosmosDB mongo API driver:
"Message": "GuidRepresentation Standard is only valid with subType UuidStandard, not with subType UuidLegacy.\r\nИмя параметра: guidRepresentation"
They said they added it to all regions: https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/20206180-support-uuid-subtype-4
I just wonder how to make it work both MongoDB and CosmosDB with Standard UUID type?
Seems to me that only CSharpLegacy type will work for both. Any suggestions?
The text was updated successfully, but these errors were encountered: