This is the original data that I want to edit -
"Languages" : [
"English",
"French"
],
And this is what I want to achieve by inserting the data such that it will leave 2 null values if there is empty spaces when entering the data at position 5 and if there is only 1 empty space then it should only add 1 null data in the array and then it should add Tamil into the array -
"Languages" : [
"English",
"French",
null,
null,
"Tamil"
],
This is what I tried -
$push: {
"Languages" : {
$each: ["Tamil"],
$position: 4
}
}