<commit_before>from mongoengine import *

connect('MySampleDB')

### MongoEngineModelSerializer supports Documents and Reference Fields, for now.


class User(Document):
    name = StringField(max_length=50)
    surname = StringField(max_length=20)
    username = StringField(max_length=30)
    email = EmailField(max_length=30)


class BlogExtension(EmbeddedDocument):
    extra_field = StringField()
    some_other_field = StringField()


class Blog(Document):
    owner = ReferenceField(User)
    title = StringField(max_length=30)
    extension = EmbeddedDocumentField(BlogExtension)
    post_list = ListField(ReferenceField('Post'))


class Post(Document):
    author = ReferenceField(User)
    blog = ReferenceField(Blog)
    text = StringField()


class Comment(Document):
    owner = ReferenceField(User)
    post = ReferenceField(Post)
    text = StringField(max_length=140)
    isApproved = BooleanField(default=False)
<commit_msg>List Field & EmbeddedDocument serializing<commit_after>from mongoengine import *

connect('MySampleDB')


class User(Document):
    name = StringField(max_length=50)
    surname = StringField(max_length=20)
    username = StringField(max_length=30)
    email = EmailField(max_length=30)


class BlogExtension(EmbeddedDocument):
    extra_field = StringField()
    some_other_field = StringField()


class Blog(Document):
    owner = ReferenceField(User)
    title = StringField(max_length=30)
    extensions = ListField(EmbeddedDocumentField(BlogExtension))
    tags = ListField(StringField())


class Post(Document):
    author = ReferenceField(User)
    blog = ReferenceField(Blog)
    text = StringField()


class Comment(Document):
    owner = ReferenceField(User)
    post = ReferenceField(Post)
    text = StringField(max_length=140)
    isApproved = BooleanField(default=False)

{'fraction_non_alphanumeric': 0.0963855421686747, 'fraction_numerical': 0.014238773274917854, 'mean_word_length': 4.970588235294118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2265604', 'n_tokens_mistral': 561, 'n_tokens_neox': 526, 'n_words': 107}