A
A
Aidar922016-06-19 22:44:51
MongoDB
Aidar92, 2016-06-19 22:44:51

How to get subfield value in mongo base when using flask-admin?

I have a mongo base with the following structure:

{
    card: {
            title: {
                type: String,
                default: "Course title"
            }
    }
}

I connected using pymongo and tried to write to the database, but it didn't work out what I wanted:
{
    {   
        "title": "fgd"
    }
}

Here is my code:
conn = pymongo.MongoClient(uri)
db = conn.get_default_database()
class CoursesForm(form.Form):   
    title = fields.TextField('Title')    
class CoursesView(ModelView):  
    column_list = ('title')    
    form = CoursesForm

Please tell me how to fix this error?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question