<filename>database.py
from flask import Flask
from flask_mongoengine import MongoEngine
from mongoengine import *
import datetime

app = Flask(__name__)
app.config['MONGODB_DB'] = 'text_similarity'
app.config['MONGODB_HOST'] = 'mongodb://localhost/text_similarity'
app.config['MONGODB_PORT'] = 27017
db = MongoEngine(app)

class Title(Document):
    title = StringField(required = True, unique = True)

class Text_content(Document):
    title = ReferenceField(Title)
    text = ListField(StringField())
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class Question(Document):
    question = StringField()
    question_tensor = ListField(ListField(FloatField()))
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class Tensor_content(Document):
    title = ReferenceField(Title)
    tensor = ListField(ListField(FloatField()))
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class All_contents(Document):
    titles = ListField(StringField())
    tensors = ListField(ListField(FloatField()))
<filename>database.py
from flask import Flask
from flask_mongoengine import MongoEngine
from mongoengine import *
import datetime

app = Flask(__name__)
app.config['MONGODB_DB'] = 'text_similarity'
app.config['MONGODB_HOST'] = 'mongodb://localhost/text_similarity'
app.config['MONGODB_PORT'] = 27017
db = MongoEngine(app)

class Title(Document):
    title = StringField(required = True, unique = True)

class Text_content(Document):
    title = ReferenceField(Title)
    text = ListField(StringField())
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class Question(Document):
    question = StringField()
    question_tensor = ListField(ListField(FloatField()))
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class Tensor_content(Document):
    title = ReferenceField(Title)
    tensor = ListField(ListField(FloatField()))
    time = DateTimeField(default =  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))

class All_contents(Document):
    titles = ListField(StringField())
    tensors = ListField(ListField(FloatField()))