Can Anyone explain how to export the result of a query with mongoexport inside a program in python ?
os.system('mongoexport -d fintapp -c portfolio --csv --fields userid,budget --query {"budget":{$exists:True}} -o fulbudg.csv')
Can Anyone explain how to export the result of a query with mongoexport inside a program in python ?
os.system('mongoexport -d fintapp -c portfolio --csv --fields userid,budget --query {"budget":{$exists:True}} -o fulbudg.csv')
os.system('''mongoexport -d fintapp -c portfolio --csv --fields userid,budget --query '{"budget":{$exists:True}}' -o fulbudg.csv''')
You need quotations around the query, and they have to be different from the other quotations you have used. In python there are 4 different ways of quoting: 'quote', "quote", '''quote''', """quote"""
Use subprocess