Skip to content

Support for TypedFrame class #12

@njordr

Description

@njordr

Hi.
It would be great if MongoFrame implements also a check of field type/structure.

Let me say I want to have all the documents of a certain type with the same _id structure:

class Test(Frame):
    _db = 'testdb'
    _collection = 'testcollection'
    _fields = {
        '_id': {
            'template': 'test_id_'
            'type': str
        },

so when I create a new Test class, i could do the following:

Test(_id=1234).insert()

and the result _id will be "test_id_1234"

In this way it's more simple also to document the structure of the document.

Let me know if this could be in the philosophy of MongoFrames or it's better to use an external validator. In the latter case, any advice?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions