code – Tools for representing JavaScript code to be evaluated by MongoDB

Tools for representing JavaScript code to be evaluated by MongoDB.

class pymongo.code.Code(code[, scope=None])

Bases: str

JavaScript code to be evaluated by MongoDB.

Raises TypeError if code is not an instance of basestring or scope is not an instance of dict.

Parameters:
  • code: string containing JavaScript code to be evaluated
  • scope (optional): dictionary representing the scope in which code should be evaluated - a mapping from identifiers (as strings) to values
scope
Scope dictionary for this instance.

Previous topic

master_slave_connection – Master-slave connection to MongoDB

Next topic

dbref – Tools for manipulating DBRefs (references to documents stored in MongoDB)

This Page