public static bool zSet(this BsonValue value, string name, BsonValue newValue) { if (value == null) { return(false); } if (newValue == null) { newValue = BsonNull.Value; } string[] names = name.Split('.'); //value = value.zGet(names.Take(names.Length - 1)); //if (value != null && value is BsonDocument) //{ //BsonDocument document = (BsonDocument)value; BsonDocument document = value.zCreateDocuments(names.Take(names.Length - 1)); string name2 = names[names.Length - 1]; if (document.Contains(name2)) { document[name2] = newValue; } else { document.Add(name2, newValue); } return(true); //} //return false; }