I'm using pymongo to write a program that takes a script file and sends it to my MongoDb server. My question is, does the
method return anything containing the results from running the script code? Is there something else I can do to get all the past query results? Here is the code running the script.
def processScript(self, filename):
self.client = pymongo.MongoClient('localhost')
db = self.client.test
data = ""
# read the .js file into a string
with open(filename) as f:
data = data + f.read()
try:
# Pass the string to mongodb be evaluated
db.eval(data)
except Exception as e:
# TODO: Find out the actual exception that would be thrown.
print "Error running script \'%s\': %s" % (filename, e)
sys.exit()