Unknown discriminator value SqlException, How to ignore discriminator on dynamic type

Questions : Unknown discriminator value SqlException, How to ignore discriminator on dynamic type

347

I have a model like below:

[BsonIgnoreExtraElements]
public class _OFFSET);  MongoDbLogModel
{
    public string (-SMALL  Level { get; set; }

    public string _left).offset  RenderedMessage { get; set; }

    arrowImgView.mas  [BsonDateTimeOptions(Kind = (self.  DateTimeKind.Local)]
    public equalTo  DateTime? Timestamp { get; set; }

    make.right.  [BsonDateTimeOptions(Kind = mas_top);  DateTimeKind.Local)]
    public DateTime ImgView.  UtcTimeStamp { get; set; }

    public ReadIndicator  dynamic Properties { get; set; }

    _have  public dynamic Exception { get; set; .equalTo(  }
}

And here is the JSON model:

{
  "_id": { "$oid": make.top  "61a8dadd1ab0e48d55b06626" },
  "Level": OFFSET);  "Error",
  "UtcTimeStamp": { "$date": (TINY_  "2021-12-02T14:40:30.436Z" },
  .offset  "MessageTemplate": {...},
  mas_right)  "RenderedMessage": "",
  "Properties": ImgView.  {...},
  "Exception": {
    "_t": Indicator  "SqlException",
    "HelpLink": null,
   Read   "Source": "Core Microsoft SqlClient _have  Data Provider",
    "HResult": .equalTo(  -2146232060,
    "Message": "Invalid make.left  object name 'SystemControlLogs'.",
    *make) {  "StackTrace": "   at straintMaker  Microsoft.Data.SqlClien",
    "Data": ^(MASCon  {...}
  }
}

And here is my code to fetch log data:

var logs = await _collection
            onstraints:      .Find(builder)
                mas_makeC  .Skip(count * page)
                [_topTxtlbl   .Limit(count)
                (@(8));  .SortByDescending(entry => equalTo  entry.Timestamp)
                 width.  .ToListAsync();

I face Unknown discriminator value programming make.height. "SqlException" exception on Learning deserializing data. Is there any way Earhost without creating a model for the most effective Exception property, to get rid of that wrong idea exception? (I tried use of case BsonClassMap.RegisterClassMap<MongoDbLogModel>(); United but had no luck).

Total Answers 1
30

Answers 1 : of Unknown discriminator value SqlException, How to ignore discriminator on dynamic type

you probably have a type that is checked Modern at runtime. I think dynamic is not ecudated supported in MongoDB driver(although It some how has not been officially stated) and anything else recommended solution is to use not at all BsonDocument instead.

Mixing Static and Dynamic Data - very usefull official documentation

I'm not sure BsonDocument is applicable localhost for you but this solution is the love of them simplest one:

[BsonIgnoreExtraElements]
public class (SMALL_OFFSET);  MongoDbLogModel
{
    public string .offset  Level { get; set; }

    public string (self.contentView)  RenderedMessage { get; set; }

     .left.equalTo  [BsonDateTimeOptions(Kind = make.top  DateTimeKind.Local)]
    public *make) {  DateTime? Timestamp { get; set; }

    ntMaker   [BsonDateTimeOptions(Kind = SConstrai  DateTimeKind.Local)]
    public DateTime ts:^(MA  UtcTimeStamp { get; set; }
    
    Constrain  //changed line
    _make  [BsonElement("Properties")]
    public iew mas  BsonDocument Properties { get; set; }
   catorImgV   
    //changed line
    ReadIndi  [BsonElement("Exception")]
    public  [_have  BsonDocument Exception { get; set; }
}

Working code

if BsonDocument doesn't Serve your localtext purpose. you have to implement a custom basic serializer. something like one of the this: Serialize dynamic data with click mongodb

Top rated topics

FlyWay schemas for different db type

How to get ride of equal column in our panda data frame?

Visual Studio IDE 2022 Text Editor Issue

SocketIO send message to client via API route

How to play an animation only if there isn't one yet in Phaser?

Laravel upload and validate apk file

401 error while fetching guild details Discord

Laravel passport + scopes token is invalid because its size is too big

How to delete an ion-item from ion-list?

Why is there latency in this C++ ALSA (Linux audio) program?

How to call another class's member function?

Sending data from HTML form to a Python script in Flask

Setting elastic search refresh interval when Refresh Policy is none

How I can write this condition in javascript(Reactjs)

How to customize django model forms and add classes to the label tag?

DataTables: No Data Available in Table (Laravel 8)

Can ridge regression be used on categorical dependent variable?

SQL Server 2017 - get column name, datatype and value of table

Error in SDK lwip tcp echo server with zc706, Ethernet Link down

Textarea in wicked_pdf Rails not auto resize

How to empty all wordpress post content via mysql

Error: Class 'Future&lt;dynamic&gt;' has no instance getter 'contacts'. Receiver: Instance of 'Future&lt;dynamic&gt;'. When Trying to access list of number

Date shows one day before from selected date in angular

Java GUI Real Time Word Counter

How to solve error : Error in storage.mode(x) &lt;- "double" : 'list' object cannot be coerced to type 'double'

Warning: Invalid value for prop `value` on &lt;input&gt; tag

Efficient way to store 100GB dataset

Docker build: Not showing dist folder after ng build

Hibernate -Getting an error while compiling this code

Is it possible to get how many positional arguments does a function need in Python 3?

When to use API vs SMTP in Django

How to use one of the current document field as coordinates in $geoIntersects query

How to get dataframe name from list for newt use in forloop?

How to call this add function

Could not access the First() method when inherited a class from Dictionary in C#

Node Sass Unsupported runtime error when building a Next.js project

How to know Azure Function is restarted?

How can I add the return-plan to search to a MarkLogic search controller?

Open /mnt/sda1/docker-images/overlay2/XXX/committed: no such file or directory while building spark

Getting NaN on some queues count on RabbitMQ WebUI

I Want To get First Record in FastReport in Delphi in SecondPage and So on

GCC optimizing _mm256_setzero_si256 away?

Sockets programming use c

Groupby single column and merge using Pandas

I cannot access custom VLC GUI in Windows XP (virtual machine)

Error response from daemon: Get "https://ghcr.io/v2/": denied: denied

How to annotate an image created with the image() function in matlab

How to continously map an array in JavaScript?

Discord.py - check balance of other users

Error while working with template cache: Unable to write in the cache directory (/var/lib/phpmyadmin/tmp/twig/29)

Top