| 
					
				 | 
			
			
				@@ -28,11 +28,12 @@ const fingerPrintSchema = new Schema({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // Use existing schema.  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const messageSchema = require('../dependencies/log/type/schemas/message.schema') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// This function is used for convert existing generic data in the designated database to be prepared for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// AuditMessage service.  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function convertDataInMongo(url: string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // Create a subject to stream data received from query at mongo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Create a subject to stream data received from query at mongo, instantiate convert service and also the database location to read the datas 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let data: Subject<any> = new Subject() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let convertService = new LoggingService() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let dbConnection = mongoose.createConnection(url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let dataModel = dbConnection.model('genericdata', fingerPrintSchema) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let messages = dbConnection.model('message', messageSchema) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -55,9 +56,12 @@ function convertDataInMongo(url: string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-let dbConnection = mongoose.createConnection("mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-let dataModel = dbConnection.model('genericdata', fingerPrintSchema) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// These declaration are for the secondary to log the converted missing data back in it's own collection at their corresponding servers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const dbConnection = mongoose.createConnection("mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const dataModel = dbConnection.model('genericdata', fingerPrintSchema) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// TO be used by the secondary Subject to convert the message log it receives to complete the synchronization process. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function convertMessageLogToCDMS(args: MessageLog){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let converted = secondary_log.convertMessageLogtoCDMS(args) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     dataModel.create(converted) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -204,8 +208,8 @@ function countdown() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 countdown() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// convertDataInMongo('mongodb://192.168.100.59:27017/primary') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// convertDataInMongo('mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+convertDataInMongo('mongodb://192.168.100.59:27017/primary') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+convertDataInMongo('mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // // Manually log the missing data given by audit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 secondary_log.init(settings.target).then(() => { 
			 |