Open Closed

MongoDB - Guid Type Change to ObjectId #1277


User avatar
0
vijay.nallala created
  • ABP Framework version: 4.3.0
  • UI type: MVC
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: N/A.. due our exisitng model has object format.
  • Steps to reproduce the issue: we need set guid in MongoDB for all entities as ObjectId. but in this ABP considering as BindData.. Can you please suggest on this

Actual : "_id" : BinData(3, "l81YjCmHgqJGQjn8TFkFwA==") Expectation : "_id" : ObjectId("5f18b4b647b1cdcaf667fa2c")


2 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @vijay.nallala

    Guid cannot be converted to ObjectId because they are two different things(different sizes, algoritms).

    (https://stackoverflow.com/a/5514441/7200126)

    So, you can't change existing Entity ids to ObjectId. You can manage only your entities and your new entities can has ObjectId as Id.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11