mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Update mongodb
This commit is contained in:
@@ -64,7 +64,7 @@ namespace SqlSugar.MongoDb
|
||||
}
|
||||
public static readonly List<string> AllowedDateParts = new List<string>()
|
||||
{
|
||||
"Date", "Year", "Month", "Day", "Hour", "Minute", "Second", "Millisecond"
|
||||
"Date","DayOfWeek", "Year", "Month", "Day", "Hour", "Minute", "Second", "Millisecond"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -386,7 +386,11 @@ namespace SqlSugar.MongoDb
|
||||
case DateType.Millisecond:
|
||||
return new BsonDocument("$millisecond", $"${itemValue}").ToJson(UtilMethods.GetJsonWriterSettings());
|
||||
case DateType.Weekday:
|
||||
return new BsonDocument("$week", $"${itemValue}").ToJson(UtilMethods.GetJsonWriterSettings());
|
||||
return new BsonDocument("$subtract", new BsonArray
|
||||
{
|
||||
new BsonDocument("$dayOfWeek", $"${itemValue}"),
|
||||
1
|
||||
}).ToJson(UtilMethods.GetJsonWriterSettings());
|
||||
case DateType.Quarter:
|
||||
// MongoDB 没有直接的quarter操作符,需自定义表达式
|
||||
var expr = new BsonDocument("$add", new BsonArray
|
||||
|
Reference in New Issue
Block a user