30
Views
6
Comments
[MongoDB] MongoDB Getting error The GuidRepresentation for the reader is CSharpLegacy
mongodb
Web icon
Forge asset by OutSystems Lab
Application Type
Traditional Web

Hi Team,


I am trying to setup a connection to mongo using the MongoDB demo application as a starting point

I get the error:

"The GuidRepresentation for the reader is CSharpLegacy, which requires the binary sub type to be UuidLegacy, not UuidStandard."

The only reference I found to this error was

You are using “Legacy” API of the driver which is present only for backward compatibility purposes.

Consider using the regular API

Any suggestions how to resolve it?


Many thanks,

Andy.


UserImage.jpg
Paul Davies

We are experiencing the same issue.  wondering if the API version needs to be updated for existing collections.  Works fine when you create a collection from Outsystems.

UserImage.jpg
G Andrew Duthie
 
MVP

I've tested one of my applications that demos the MongoDB connector, as well as the "Try Now" in the connector itself, and I'm not seeing any errors. Can you share an OML that reproduces the issue?

UserImage.jpg
Paul Davies

Hi Andrew,

To replicate the issue have an existing MongoDB collection that was created with a recent version of the DB.  This collection will have a GUidRepresentation of UuidStandard.  If you then try to run MngCollection_List against this collection you will get the error  in the attached screen shot because the the component is looking to run against the legacy UuidLegacy GuidRepresentation.


Capture.PNG
UserImage.jpg
Paul Davies

Looks like to support users of the newer Guid standard and the Legacy standard an option will need to be in place for developers to choose which Guid is being used on the Database for the latest drivers (ie 2.11) this is

https://mongodb.github.io/mongo-csharp-driver/2.11/reference/bson/guidserialization/

for the current driver looks like a toggle

https://stackoverflow.com/questions/16369308/use-guidrepresentation-standard-with-mongodb

UserImage.jpg
Paul Davies

Digging deeper into the current component we see that the older format supoprted by the 2.4.2 API is an issue when connecting to any more recent MongoDB instances.   The component will fail on most API calls where GUIDRepresentation is Standard.


   

UserImage.jpg
Paul Davies

I've started publishing an updated version of this component so that we can deliver the clients apps. This uses latest API version, latest .Net Framework and updated dnsclient.  By default supports the latest MongoDB and uses latest Guid formats.

I've kept where possible the same server action names to make it easier for anyone updating.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=12234

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.