On Mon, 2013-11-18 at 14:09 +0100, Nicolas Clairon wrote:
> Hi,
>
>
> The simplest solution is to set the 'parent' field as empty array. The
> only issue is that this part of this structure won't be validated.
>
>
> class MetaType(Document):
> __database__ = 'test'
> __collection__ = 'meta_types'
> structure: {
> 'description': basestring,
> 'parent': []
> }
>
In this case, quite a lot of possible values could go. We thought of
the following:
structure = {
'description': basestring, # Description (name)
'parent': ObjectId #
}
Here at least only an existing document id could go. The plan is to
write a validator that will restrict the scope of ObjectIds to those
of the current class.
thanks
--
GN