Saving SortedList (C#) in MongoDB - Key Issue

36 Views Asked by At

The use of '.' in the key of a SortedList causes problems when saving in MongoDB because the '.' denotes the lower level.

Ex:

UpdateDefinition<User> updateDefinition = Builders<User>.Update.Set("lesPortefeuilles.sorPortefeuilles." + strName, value);

does not allow a key to contain a '.'

It's ok for "lesPortefeuilles.sorPortefeuilles." but not for strName if strName contains a '.'.

Ex: if strName = "Jimmy.Hendrix" this does not work.

I tried replacing '.' by "." without success.

Do you have a solution, please?

0

There are 0 best solutions below