This file contains 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
class Person (db.Document): | |
name = db.StringField(required=True) | |
created_date = db.ComplexDateTimeField(default=datetime.datetime.utcnow(), required=True) | |
def to_dict(self): | |
return helper.mongo_to_dict(self,[]) | |
#helper.py | |
def mongo_to_dict(obj, exclude_fields): |
This file contains 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
// list of $type values: http://docs.mongodb.org/manual/reference/operator/type/ | |
db.person.find( { 'integer_id' : { $type : 2 } } ).forEach( function (x) { | |
x.integer_id = new NumberLong(x.integer_id); // convert field to Long | |
db.person.save(x); | |
}); |