mongodb - MotorEngine - How to represent the equivalent of the foreign key in model? -


in mongodb have document represents balance has stakeholder's id field.

i need relate these 2 classes, balance , stakeholder, don't know what's proper way. i've seen there's field appropiate still don't understand it: embeddeddocumentfield()

class balance(document):     id = uuidfield()     creation_date = datetimefield(auto_now_on_insert=true)     gross_balance = floatfield(required=true, min_value=0, default=0)     balances_description = stringfield(required=true, max_length=255)     stake_holder = #fk stakeholder  class stakeholder(document):     ... 

any idea?

if stakeholder represents document other collection , stake_holder objectid, should use referencefield()

stake_holder = referencefield(reference_document_type=stakeholder)


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -