flask-mongoengine
flask-mongoengine copied to clipboard
New Field Type: EmbeddedDocumentListField
Basically same as ListField but provides some additional query helpers.
+1
EmbeddedDocumentListField
already exists in MongoEngine (see https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/fields.py#L718). Or did I misunderstand the issue?
@wojcikstefan Why did you close this? You are indeed misunderstanding I think...
I know EmbeddedDocumentListField exists in mongoengine already, I even linked to their documentation. The links are broken now, but here are the latest:
field docs: http://docs.mongoengine.org/apireference.html#mongoengine.fields.EmbeddedDocumentListField
query docs: http://docs.mongoengine.org/apireference.html#embedded-document-querying
EmbeddedDocumentListFields are NOT SUPPORTED by flask-mongoengine. That is why I opened this issue.
There is no WTF convertor defined for EmbeddedDocumentListFields. There are convertors for EmbeddedDocuments, and for ListFields, but that is not sufficient. EmbeddedDocumentListFields have additional functionality that is not the same as a ListField of EmbeddedDocument fields.
There is no WTF convertor defined for EmbeddedDocumentListFields. There are convertors for EmbeddedDocuments, and for ListFields, but that is not sufficient. EmbeddedDocumentListFields have additional functionality that is not the same as a ListField of EmbeddedDocument fields.
Ah, thanks for clarifying. I didn't infer from the original description that you're talking about supporting this field via the WTF model form. That's definitely worth looking into. Would you like to give it a shot and send a PR?
Indeed I would love to, but my time is limited until January. I can take a shot at it then, however.
Great! I'll let you know if I get a chance to look at it earlier. If not, looking forward to Jan! :)
Any chance to implement this?
Nope, I've just been using db.ListField(db.EmbeddedDocumentField())
:(
I think maybe all we need to do is add a converter here?
https://github.com/MongoEngine/flask-mongoengine/blob/56caa8a8fc8f1b6b8e3d300ce0f38d2d1f906c1a/flask_mongoengine/wtf/orm.py#L161
https://github.com/MongoEngine/flask-mongoengine/blob/56caa8a8fc8f1b6b8e3d300ce0f38d2d1f906c1a/flask_mongoengine/wtf/orm.py#L192
Something that merges these two?
Anything new for this issue?
+1
If nobody is working on this, I can take a stab at it in a week or so.
@gordol +1 I have the same issue not for wtf forms I need it to use with Flask 1.02 and Flask Admin and is it possible ?
too busy myself, we've just worked around it in the meantime...
@gordol is the EmbeddedDocumentListField much efficient than ListField ?
Its more about WTF-form realization in model_form
, if I correct understand issue.
https://github.com/flask-admin/flask-admin/issues/1644
it this related to mongoengine issue ?
any news ? @gordol
@insspb needed field..
+1
we ended up just using a listfield of embedded docs if i recall correctly.
anything you can do with an EmbeddedDocumentList you can do with a List of EmbeddedDocuments and Aggregation Pipelines to get your agg/filter/map/reduce/etc. it's not exactly the same as far as mongoengine api is concerned, but it worked well enough for our use cases. actually, having the aggregation pipeline made it easier to do some other things later, but i digress.
anyway, that was ages ago (3-5 years), i don't have that code base around now, apologies.