mongodb OperationFailure ......

时间:2012-04-30 07:15:52

标签: python mongodb

当我尝试从Python使用新的Aggregate框架时,我收到了下一条消息:

OperationFailure: command SON([('aggregate', 'call_log'), ('pipeline', [{'$project': {u'date': '1', u'status': '1', u'number': '1', u'description': '1'}}])]) failed: exception: field path references must be prefixed with a '$' ("1"

python的代码:

db.command('aggregate', 'test_collection', pipe_line=[{'$project':{u'date': '1', u'status': '1', u'number': '1', u'description': '1'}}])

这条消息是什么意思?哪里出错?

谢谢!

1 个答案:

答案 0 :(得分:2)

假设您不应该写'1',而是1'1'(带引号)被解释为字符串,这会导致错误。

相关问题