document.Add(dc.ColumnName.ToString(), null );MachineLogRawDataCollection.InsertOne(document);I would like to insert “null” value instead of string.Empty value for Datetime field.
Hi Thomas,
If you’re using MongoDB C# Driver v2.3+ ,you can utilise BsonNull class to represent null.
For example:
document.Add("fieldName", BsonNull.Value );
collection.InsertOne(document);
If you still have further question on this, please include your MongoDB C# Driver version.
Regards,
Wan.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/oHCfdjIo-rg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1a8a6c8c-b1a8-4340-b309-65447b77b3bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.