Skip to content
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

"$type" property is missing after data migration #144

Open
bibalek opened this issue Sep 24, 2024 · 0 comments
Open

"$type" property is missing after data migration #144

bibalek opened this issue Sep 24, 2024 · 0 comments

Comments

@bibalek
Copy link

bibalek commented Sep 24, 2024

Hi,
We have a typed data structure with data models based on class inheritance.
To save/read data on cosmosdb we use Newtonsoft (de)serialization which normally works fine. Example of data model:

public class Pet
{
    public string Name { get; set; }
}

public class Dog : Pet
{
    public string OtherName { get; set }
}

This is a piece of saved document how it is persisted:

{
  ...,
  "myFavouritePet": {
    "$type": "MyProject.Pets.Dog, MyProject",
    "Name": "Foo",
    "OtherName": "OtherFoo"
  },
  ...
}

After running the migration tool, from cosmos-nosql source to json or other cosmos-nosql sink, the migrated data contains everything except the "$type" property:

{
  ...,
  "myFavouritePet": {
    "Name": "Foo",
    "OtherName": "OtherFoo"
  },
  ...
}

Not sure if that is internal tool issue or rather the configuration. Here is the exemplary setting I use:

{
  "Source": "cosmos-nosql",
  "Sink": "cosmos-nosql",
  "SourceSettings": {
    "UseRbacAuth": true,
    "AccountEndpoint": "https://...",
    "EnableInteractiveCredentials": true,
    "Database": "mySourceDb",
    "Container": "mySourceContainer",
    "IncludeMetadataFields": true,
    "InitClientEncryption": false,
  },
  "SinkSettings": {
    "ConnectionString": "AccountEndpoint=https://...;AccountKey=...",
    "Database": "myDatabase",
    "Container": "myContainer",
    "PartitionKeyPath": "myPartitionKeyPath",
    "RecreateContainer": true,
    "IncludeMetadataFields": true,
    "WriteMode": "InsertStream",
    "PreserveMixedCaseIds": true,
  },
}

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant