scout/adapter/mongo/user.py
def add_user(self, user_obj):
        """Add a user object to the database

            Args:
                user_obj(scout.models.User): A dictionary with user information
        
            Returns:
                user_info(dict): a copy of what was inserted
        """
        LOG.info("Adding user %s to the database", user_obj['email'])
        if not '_id' in user_obj:
            user_obj['_id'] = user_obj['email']
    
        try:
            self.user_collection.insert_one(user_obj)
            LOG.debug("User inserted")
        except DuplicateKeyError as err:
            raise IntegrityError("User {} already exists in database".format(user_obj['email']))

        return user_obj
def add_user(self, user_obj):
        """Add a user object to the database

            Args:
                user_obj(scout.models.User): A dictionary with user information
        
            Returns:
                user_info(dict): a copy of what was inserted
        """
        LOG.info("Adding user %s to the database", user_obj['email'])
        if not '_id' in user_obj:
            user_obj['_id'] = user_obj['email']
    
        try:
            self.user_collection.insert_one(user_obj)
            LOG.debug("User inserted")
        except DuplicateKeyError as err:
            raise IntegrityError("User {} already exists in database".format(user_obj['email']))

        return user_obj
Add a user object to the database

            Args:
                user_obj(scout.models.User): A dictionary with user information
        
            Returns:
                user_info(dict): a copy of what was inserted