尝试解析BsonDocument - JSON读者期待一个值,但找到了

时间:2015-08-21 13:39:00

标签: c# .net mongodb mongodb-.net-driver

我尝试运行以下代码:

    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'.

我不明白为什么?

0 个答案:

没有答案