-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore DictField and ListField when not required #2342
Comments
I think, when defining Document class you are implying a structure, similar to the relational model, so that's a logical behaviour of mongoengine. |
So I guess the only solution is to basically create an Embedded Document and then leave it out of the DynamicDocument definition and then provide it as a kwarg when constructing a case that involves it. |
I'll take a look into maybe handling it that way. Basically I have a bunch of documents that have different attributes and I want to be able to quickly look up what documents do not have those attributes. Those attributes are strictly structured. However, I've actually restructured the documents to be a bit smaller and allow for me to just store these attributes separately. EDIT:
Or maybe you misunderstand. Say I have a series of images and some of these images have points of interest and others maybe just have boxes of interest. I am storing the images basically as:
As it is now if I have an image that has no boxes, it would appear as:
So if I want to quickly see images that only have points and no boxes, the box is still an element in it, which adds a layer of complexity. |
Currently if I have an object such as
class Foo(DynamicDocument): _id = ObjectIdField(required=True, default=ObjectId, primary_key=True) bar = DictField()
When I create a new item and add it I get:
{ _id: ObjectId(<objectid>), bar: {} }
I would rather this be
{ _id: ObjectId(<objectid>) }
Is there a way to do this currently? List has similar behavior by creating a [].
The text was updated successfully, but these errors were encountered: