KennyPowers
KennyPowers

Reputation: 5025

mongodb OperationFailure...

When I try to to use new Aggregate framework from Python I got the next message:

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"

The python's code:

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

What does this message means? Where's the error?

Thanks!

Upvotes: 0

Views: 579

Answers (1)

daeq
daeq

Reputation: 1181

Suppose, you should write not '1', but 1. '1' (with quotes) is interpreted as string, which causes error.

Upvotes: 2

Related Questions