original_docstring: 
          Counts the number of new users of the bot.
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :return: number of new users
          
docstring: Counts the number of new users of the bot.
docstring_tokens: Counts the number of new users of the bot .
code: def new_users(collection: Text, month: int = 1):
  
          """
          Counts the number of new users of the bot.
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :return: number of new users
          """
  
          client, message = HistoryProcessor.get_mongo_connection()
          message = ' '.join([message, f', collection: {collection}'])
          with client as client:
              db = client.get_database()
              conversations = db.get_collection(collection)
              values = []
              try:
                  values = list(conversations.aggregate([{"$unwind": {"path": "$events", "includeArrayIndex": "arrayIndex"}},
                                                {"$match": {"events.name": {"$regex": ".*session_start*.", "$options": "$i"}}},
                                                {"$group": {"_id": '$sender_id',
                                                            "latest_event_time": {"$first": "$events.timestamp"}}},
                                                {"$match": {"latest_event_time": {
                                                                "$gte": Utility.get_timestamp_previous_month(month)}}},
                                                {"$group": {"_id": None, "count": {"$sum": 1}}},
                                                {"$project": {"_id": 0, "count": 1}}
                                                ]))
              except Exception as e:
                  logger.error(e)
                  message = '\n'.join([message, str(e)])
              if not values:
                  count = 0
              else:
                  count = values[0]['count'] if values[0]['count'] else 0
              return (
                  {"new_users": count},
                  message
              )
code_tokens: def new_users ( collection : Text , month : int = 1 ) : client , message = HistoryProcessor . get_mongo_connection ( ) message = ' ' . join ( [ message , f', collection: {collection}' ] ) with client as client : db = client . get_database ( ) conversations = db . get_collection ( collection ) values = [ ] try : values = list ( conversations . aggregate ( [ { "$unwind" : { "path" : "$events" , "includeArrayIndex" : "arrayIndex" } } , { "$match" : { "events.name" : { "$regex" : ".*session_start*." , "$options" : "$i" } } } , { "$group" : { "_id" : '$sender_id' , "latest_event_time" : { "$first" : "$events.timestamp" } } } , { "$match" : { "latest_event_time" : { "$gte" : Utility . get_timestamp_previous_month ( month ) } } } , { "$group" : { "_id" : None , "count" : { "$sum" : 1 } } } , { "$project" : { "_id" : 0 , "count" : 1 } } ] ) ) except Exception as e : logger . error ( e ) message = '\n' . join ( [ message , str ( e ) ] ) if not values : count = 0 else : count = values [ 0 ] [ 'count' ] if values [ 0 ] [ 'count' ] else 0 return ( { "new_users" : count } , message )
short_docstring: Counts the number of new users of the bot.
short_docstring_tokens: Counts the number of new users of the bot .
comment: """
          Counts the number of new users of the bot.
  
          :param collection: collection to connect to
          :param month: default is current month and max is last 6 months
          :return: number of new users
          """