<commit_before>#! tools-env/bin/python

from mongoengine import connect, Document, EmailField, StringField, BooleanField, DateTimeField, ReferenceField, IntField

connect(db='project',
    host = 'localhost',
    port = 27017)

class User(Document):
    email = EmailField(required = True, unique = True)
    alias = StringField(required = True, unique = True)
    password = StringField(min_length = 8, required = True)
    emailVerified = BooleanField(default = False)
    lastLogin = DateTimeField()
    allowTracking = BooleanField(default = False)
    isMod = BooleanField(default = False)

class Posts(Document):
    #max length of title is 140 characters
    title = StringField(required = True, max_length = 140)
    author = ReferenceField(User)
    #max length of content is 10000 characters
    content = StringField(max_length = 10000)
    score = IntField(default = 0)
<commit_msg>Updated create post to comply with collections.Posts changes<commit_after>#! tools-env/bin/python

from mongoengine import connect, Document, EmailField, StringField, BooleanField, DateTimeField, ReferenceField, IntField, ListField, EmbeddedDocumentField
import datetime

connect(db='project',
    host = 'localhost',
    port = 27017)

class User(Document):
    email = EmailField(required = True, unique = True)
    alias = StringField(required = True, unique = True)
    password = StringField(min_length = 8, required = True)
    emailVerified = BooleanField(default = False)
    lastLogin = DateTimeField()
    allowTracking = BooleanField(default = False)
    isMod = BooleanField(default = False)
    apiKey = StringField()

class Comment(Document):
    created_at = DateTimeField(default=datetime.datetime.now, required=True)
    author = ReferenceField(User)
    body = StringField(max_length=1000, required=True)

class Posts(Document):
    created_at = DateTimeField(default=datetime.datetime.now, required=True)
    #max length of title is 140 characters
    title = StringField(required = True, max_length = 140)
    author = ReferenceField(User)
    #max length of content is 10000 characters
    content = StringField(max_length = 10000)
    score = IntField(default = 0)
    comments = ListField(EmbeddedDocumentField('Comment'))
    meta = {
        'allow_inheritance': True
    }


{'fraction_non_alphanumeric': 0.0937227550130776, 'fraction_numerical': 0.021795989537925022, 'mean_word_length': 4.412735849056604, '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': '2182928', 'n_tokens_mistral': 678, 'n_tokens_neox': 625, 'n_words': 181}