diff --git a/chatterbot/adapters/storage/mongodb.py b/chatterbot/adapters/storage/mongodb.py index 2ac380d4b..3c02c7bcc 100644 --- a/chatterbot/adapters/storage/mongodb.py +++ b/chatterbot/adapters/storage/mongodb.py @@ -29,6 +29,9 @@ def __init__(self, **kwargs): # The mongo collection of statement documents self.statements = self.database['statements'] + # Set a requirement for the text attribute to be unique + self.statements.create_index('text', unique=True) + def count(self): return self.statements.count()