Created
September 18, 2013 12:47
-
-
Save kf0jvt/6608677 to your computer and use it in GitHub Desktop.
After importing json into mongo some date fields may be interpreted as text. This script will go through and convert those fields to dates in mongo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/mongo yourdbname --eval "db.yourcollectionname.find().forEach(function(doc){doc.yourdatefield = new ISODate(doc.yourdatefield);db.yourcollectionname.save(doc)});" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment