<commit_before>''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError

from django_mongokit import get_database

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId

''' imports from application folders/files '''
from gnowsys_ndf.ndf.models import Node

####################################################################################################################

class Command(BaseCommand):
    """This update-script updates fields' data-types or their values.
    """

    help = "\tThis update-script updates fields' data-types or their values."

    def handle(self, *args, **options):
        
        collection = get_database()[Node.collection_name]

        collection.update({'location': {}}, {'$set': {'location': []}}, upsert=False, multi=True)
        

        # --- End of handle() ---
<commit_msg>Updates location fields' values from '{}' to '[]'; and Renames field - 'modified_by' to 'contributors'<commit_after>''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError

from django_mongokit import get_database

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId

''' imports from application folders/files '''
from gnowsys_ndf.ndf.models import Node

####################################################################################################################

class Command(BaseCommand):
    """This update-script updates fields' data-types or their values.
    """

    help = "\tThis update-script updates fields' data-types or their values."

    def handle(self, *args, **options):
        
        collection = get_database()[Node.collection_name]

        # Renames field: 'modified_by' to 'contributors'
        collection.update({'modified_by': {'$exists': True}}, {'$rename': {'modified_by': "contributors"}}, upsert=False, multi=True)

        # Updates location fields' values from '{}' (empty dictionary) to '[]' (empty list)
        collection.update({'location': {}}, {'$set': {'location': []}}, upsert=False, multi=True)
        

        # --- End of handle() ---

{'fraction_non_alphanumeric': 0.2214765100671141, 'fraction_numerical': 0.0, 'mean_word_length': 4.236533957845433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2148168', 'n_tokens_mistral': 583, 'n_tokens_neox': 563, 'n_words': 170}