if (!string.IsNullOrEmpty(STATES)) { DateTime? dtnull = null; //Return if (STATES == "Return") { //list.Add(Query.NE("ReturnTime", ((MongoDB.Bson.BsonValue)DateTime.Now).AsBsonNull)); list.Add(Query.NE("ReturnTime", ((MongoDB.Bson.BsonValue)dtnull).AsNullableDateTime)); //list.Add(Query.Null } //Not Return if (STATES == "Not Return") { //list.Add(Query.EQ("ReturnTime", (Nullable)null)); list.Add(Query.EQ("ReturnTime", ((MongoDB.Bson.BsonValue)dtnull).AsNullableDateTime)); } }
list.Add(Query.NE("ReturnTime", null));
list.Add(Query.NE("ReturnTime", “null”));
都是没用的
要用里面的
自带属性
AsNullableDateTime 获取