<commit_before>ConnectionStructureSubscription = Meteor.subscribe('connectionStructure');

Session.set('showReloadingAlert', false);
CurrentDatabaseId = false;

CurrentSession = new ReactiveObjects({
  connection: null,
  database: null,
  collection: null,
  mongoCollection: null,
  mongoCollectionSubscription: null,
  mountedCollections: null,
  documentsSelector: '{}',
  documentsOptions: {},
  documentsRandomSeed: 0,
  documentsPaginationSkip: 0,
  documentsPaginationLimit: 20
});


Meteor.startup(function() {
});

Tracker.autorun(function () {
  FlowRouter.watchPathChange();
  var currentContext = FlowRouter.current();
  var routeParams = currentContext.params;

  if (!ConnectionStructureSubscription.ready()) return false;

  CurrentSession.connection = null;
  CurrentSession.database = null;
  CurrentSession.collection = null;
  CurrentSession.documentsSelector = '{}';
  CurrentSession.documentsOptions = {};
  CurrentSession.documentPaginationSkip = 0;

  let Location = {};
  if (routeParams.connection) {
    CurrentSession.connection = Connections.findOne({slug: routeParams.connection});
    if (!CurrentSession.connection) FlowRouter.go('/');

    if (CurrentSession.connection && routeParams.database) {
      CurrentSession.database = Databases.findOne({
        name: routeParams.database,
        connection_id: CurrentSession.connection._id
      });
      if (!CurrentSession.database) FlowRouter.go('/');

      if (dr.isDemo && CurrentSession.database.name.indexOf('dummy') !== 1) FlowRouter.go('/');

      if (CurrentSession.database && !CurrentSession.mountedCollections) {
         Meteor.call('mountCollections', CurrentSession.database._id, function(error, result) {
           if (error) FlowRouter.go('/');
           MountedCollections = result;<commit_msg>Server restart bug fix<commit_after>ConnectionStructureSubscription = Meteor.subscribe('connectionStructure');

Session.set('showReloadingAlert', false);
CurrentConnectionId = false;
CurrentDatabaseId = false;

CurrentSession = new ReactiveObjects({
  connection: null,
  database: null,
  collection: null,
  mongoCollection: null,
  mongoCollectionSubscription: null,
  mountedCollections: null,
  documentsSelector: '{}',
  documentsOptions: {},
  documentsRandomSeed: 0,
  documentsPaginationSkip: 0,
  documentsPaginationLimit: 20
});


Meteor.startup(function() {
});

Tracker.autorun(function () {
  FlowRouter.watchPathChange();
  var currentContext = FlowRouter.current();
  var routeParams = currentContext.params;

  if (!ConnectionStructureSubscription.ready()) return false;

  CurrentSession.connection = null;
  CurrentSession.database = null;
  CurrentSession.collection = null;
  CurrentSession.documentsSelector = '{}';
  CurrentSession.documentsOptions = {};
  CurrentSession.documentPaginationSkip = 0;

  let Location = {};
  if (routeParams.connection) {
    CurrentSession.connection = Connections.findOne({slug: routeParams.connection});
    if (!CurrentSession.connection) FlowRouter.go('/');

    if (CurrentSession.connection._id != CurrentConnectionId && CurrentConnectionId != false) {
      Session.set('showReloadingAlert', true)
      Meteor.call('changeDatabase');
    } else {
      CurrentConnectionId = CurrentSession.connection._id;
    }

    if (CurrentSession.connection && routeParams.database) {
      CurrentSession.database = Databases.findOne({
        name: routeParams.database,
        connection_id: CurrentSession.connection._id
      });
      if (!CurrentSession.database) FlowRouter.go('/');

      if (dr.isDemo && CurrentSession.database.name.indexOf('dummy') !== 1) FlowRouter.go('/');

      if (CurrentSession.database && !CurrentSession.mountedCollections) {
         Meteor.call('mountCollections', CurrentSession.database._id, function(error, result) {
           if (error) FlowRouter.go('/');
           MountedCollections = result;
{'fraction_non_alphanumeric': 0.12223934257832562, 'fraction_numerical': 0.0030816640986132513, 'mean_word_length': 4.636758321273517, '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': '7509517', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1030, 'n_words': 197}