def missing_version_field(data_relation, reference):
 value_field = data_relation['field']
 version_field = app.config['VERSION']
 collection = data_relation['resource']
 query = {}
 query[value_field] = reference[value_field]
 query[version_field] = {'$exists': False}
 return app.data.find_one(collection, None, **query)

def missing_version_field ( data_relation , reference ) : value_field = data_relation [ 'field' ] version_field = app . config [ 'VERSION' ] collection = data_relation [ 'resource' ] query = { } query [ value_field ] = reference [ value_field ] query [ version_field ] = { '$exists' : False } return app . data . find_one ( collection , None , ** query )
returns a document if it matches the value_field but doesnt have a _version field .