1//If teamIds is already an array, then you shouldn't wrap it in another array:
2
3Team.find({
4 '_id': { $in: teamIds }
5}, function(err, teamData) {
6 console.log("teams name " + teamData);
7});
8
9//If teamIds is a string of comma-separated id values, you need to convert it into an array of values using split:
10
11Team.find({
12 '_id': { $in: teamIds.split(',') }
13}, function(err, teamData) {
14 console.log("teams name " + teamData);
15});
16
17
1//e.g. : There's an array of Team Ids which needs to find documents from db
2Team.find({
3 '_id': { $in: teamIds.split(',') }
4}, function(err, teamData) {
5 console.log("teams name " + teamData);
6});
7