I have a POST method (c#) that inserts some data in MongoDB's collection. The type of the 'Data' field is 'object'. The model class for post request is below.
public class Products{
[required]
public string Id {get; set;}
[required]
public object Data {get; set;}
[required]
public bool Valid {get; set;}
}
So the issue is, I insert a json structure data in 'Data' field and it gets added too. However, when I enter a string type data like Data = "Entering dummy data"; This also gets added. Is there a way to avoid string getting added? Is there a datatype to insert only json type object. or any check be used for that?