This question has been asked so many times but I can't make what I want so I ask for your help.
I have 2 arrays checkMyDataSources and lesInfosMachines.
I need to run through checkMyDataSources to check if there is no occurrence of any items in lesInfosMachines.
The content of checkMyDataSources can be something like ["datasource_A","datasource_B","datasource_D","datasource_C"] and the name is linked with the name of each item in lesInfosMachines who contains thing like ["A","B","C","D"].
The problem is that I'm not able to run through all the checkMyDataSources, I mean when the cell A and Amachine are different it call createDataSourcedespite Amachine is maybe in the cell D.
var lesInfosMachines = InfosMachines.find({});
if(checkMyDataSources.length < 1){
console.log("there is not datasource, we will create them all");
callInitDS();
}else{
console.log("there is datasource, we will check them");
lesInfosMachines.forEach(Meteor.bindEnvironment(function(machineInfo) {
console.log("test machine " + machineInfo.nameMachine)
for (var i = 0; i < checkMyDataSources.length; i++) {
console.log("test on " + checkMyDataSources[i].name.split("_")[1]);
if(checkMyDataSources[i].name.split("_")[1] === machineInfo.nameMachine){
console.log("Datasource: " + machineInfo.nameMachine + " already exist." );
}else{
if(machineInfo.ipAddr != null){
console.log("going to create " + machineInfo.nameMachine);
createDataSource(machineInfo.nameMachine, machineInfo.ipAddr);
}else{
console.log("going to create " + machineInfo.nameMachine +
" with a fake @ip because it was null
ONLY FOR TESTING WE NEED TO REMOVE THIS"
);
createDataSource(machineInfo.nameMachine, "myFakeIP");
}
};
}
}));
console.log("test finished")
}
I hope my question is understandable and thank you for the help
[EDIT2] to simplify I want to test aMachine on A,B,C,D of checkMyDataSources and if there isn't aMachine in one of those cells (but at the end) then call createDataSource()

if {<String>.indexOf(<String2>) > -1}?