Reputation: 836
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_id
can be ''
empty string, or else it should be unique
. I've heard the term sparse
for this. (It need not be unique if it is empty string. This is important.)flashscore_name
and player_id
should be unique.Any help is appreciated. In case of duplicates, I want to update value of translated_name
.
Upvotes: 1
Views: 20