我尝试运行以下代码:
var groupByTimeSpans = BsonDocument.Parse(
@"{
'_id' : {
$subtract : [ ' +
{ $subtract: [ '$created', new Date('1970-01-01') ] },
{ $mod: [
{ $subtract: [ '$created', new Date('1970-01-01') ] },
1000 * 60 * " + sessionSize.ToString() +
@"]}
]
},
'count': { $sum: 1 }
}");
但运行时向我抛出错误
JSON reader was expecting a value but found '$created'.
我不明白为什么?