When a join fails, the element of the join in the final collection is None. It is possible to use another value by specifying the default parameter of the join function.
default_spacecraft_mission = {'name': None, 'mission_type': None, 'launch_date': None}
global_space_crafts = qjoin.on(spacecrafts) \
.join(spacecrafts_mission_infos, left='name', right='mission', default={) \
.all()
for spacecraft, spacecraft_mission_infos in global_space_crafts:
print(spacecraft['name'])
documentation
- write the section
Join use default value when the join fails in User guide > Join
When a join fails, the element of the join in the final collection is
None. It is possible to use another value by specifying thedefaultparameter of thejoinfunction.documentation
Join use default value when the join failsinUser guide>Join