Hello : i have the following script on mongodb :
db.shipping.find({"dateCreated":{$type:"string"}}).forEach(
function(doc){
doc["dateCreated"]=new Date(doc["dateCreated"]);
db.shipping.save(doc);
})
I need to execute in pymongo
Its a simple function to parse strings to date and i want to add this task to apache airflow
Regards
db.shipping.updateMany({'dateCreated': {'$type':"string"}}, {'$set': {"dateCreated": new Date('$dateCreated')}})Also what error are you getting when you try to execute what you have using pymongo?