JSON reader was expecting a value but found 'Long'. BsonArray.Deserialize. Mongo

Viewed 68

I know there are possible duplicates. But I've been looking at these questions. There they have a function, then aggregation. But this is the usual answer from mongo shell. I got this result from mongo shell

[
{
_id: ObjectId("5da08d49949b4c000100b90b"), 
ModifiedOn: ISODate("2019-10-11T14:10:17.461Z"), 
UniqueNumber: Long("22635664")
}
]

I tried to do the following

BsonSerializer.Deserialize<BsonArray>(string)

But I get this

JSON reader was expecting a value but found 'Long'.

What can i do? Apparently this is not the correct Bson format. But if I remove this string UniqueNumber: Long("22635664"). Then everything works. What should I do?

By the way. I can't use custom classes. Because json will change. This result is output from mongosh. But if i will use mongo then it will parse.

1 Answers

as far as I know, the shell type is named NumberLong which works well here

Related