parameters: (entity_doc)
docstring: Check for entity duplicates in DB
      :param entity_doc: entity document
      :return: [], a list of errors otherwise
docstring_summary: Check for entity duplicates in DB
      :param entity_doc: entity document
      :return: [], a list of errors otherwise
docstring_tokens: Check for entity duplicates in DB : param entity_doc : entity document : return : [] a list of errors otherwise
function: def check_entity_dup(entity_doc):
      """
      Check for entity duplicates in DB
      :param entity_doc: entity document
      :return: [], a list of errors otherwise
      """
  
      query = {'_id.id': entity_doc['_id']['id']}
  
      if 'type' in entity_doc['_id']:
          query['_id.type'] = entity_doc['_id']['type']
      else:
          query['_id.type'] = {'$exists': False}
  
      if 'servicePath' in entity_doc['_id']:
          query['_id.servicePath'] = entity_doc['_id']['servicePath']
      else:
          query['_id.servicePath'] = {'$exists': False}
  
      c = db[COL].find(query).count()
      if c > 1:
          return ['     * ERROR: duplicated entities number with same _id subfields: {0}'.format(c)]
      else:
          return []
function_tokens: def check_entity_dup ( entity_doc ) : query = { '_id.id' : entity_doc [ '_id' ] [ 'id' ] } if 'type' in entity_doc [ '_id' ] : query [ '_id.type' ] = entity_doc [ '_id' ] [ 'type' ] else : query [ '_id.type' ] = { '$exists' : False } if 'servicePath' in entity_doc [ '_id' ] : query [ '_id.servicePath' ] = entity_doc [ '_id' ] [ 'servicePath' ] else : query [ '_id.servicePath' ] = { '$exists' : False } c = db [ COL ] . find ( query ) . count ( ) if c > 1 : return [ '     * ERROR: duplicated entities number with same _id subfields: {0}' . format ( c ) ] else : return [ ]