mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update mongodb
This commit is contained in:
parent
5032a7d1fe
commit
92f5c68c57
@ -64,7 +64,7 @@ namespace SqlSugar.MongoDb
|
|||||||
}
|
}
|
||||||
public static readonly List<string> AllowedDateParts = new List<string>()
|
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:
|
case DateType.Millisecond:
|
||||||
return new BsonDocument("$millisecond", $"${itemValue}").ToJson(UtilMethods.GetJsonWriterSettings());
|
return new BsonDocument("$millisecond", $"${itemValue}").ToJson(UtilMethods.GetJsonWriterSettings());
|
||||||
case DateType.Weekday:
|
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:
|
case DateType.Quarter:
|
||||||
// MongoDB 没有直接的quarter操作符,需自定义表达式
|
// MongoDB 没有直接的quarter操作符,需自定义表达式
|
||||||
var expr = new BsonDocument("$add", new BsonArray
|
var expr = new BsonDocument("$add", new BsonArray
|
||||||
|
Loading…
Reference in New Issue
Block a user