Database structure looks like this.
from mongokit import Document
class FlashscoreNameMap(Document):
structure = {
"flashscore_name": basestring,
"translated_name": basestring,
"player_id": basestring,
"timestamp": float
}
default_values = {
"translated_name": '',
"player_id": ''
}
indexes = [
# How do I declare validation rules here?
]
use_dot_notation = True
Validation Rules to be enforced
player_idcan be''empty string, or else it should beunique. I've heard the termsparsefor this. (It need not be unique if it is empty string. This is important.)- Combination of
flashscore_nameandplayer_idshould be unique.
Any help is appreciated. In case of duplicates, I want to update value of translated_name.