Pravitha V
Pravitha V

Reputation: 3308

Why '$pull' does not work in cherrypy

I used $pull for removing a field in embedded document in mongodb. i used cherrypy to implemet this. this is my code.

models.login_info.update({},{$pull:{location:{time:date}}})

but while i run this code it gives me lexical error as follows.

Lexical error at line 48, column 39. Encountered: "$" (36), after : ""

in the terminal i get the following error notification

models.login_info.update({},{$pull:{location:{time:date}}}) ^ SyntaxError: invalid syntax

Upvotes: 1

Views: 230

Answers (1)

Blender
Blender

Reputation: 298472

Wrap $pull in quotes:

'$pull': {...

Upvotes: 4

Related Questions