(vegetables,',',''))+1;
db.collection.aggregate(
[
{ $unwind : "$vegetables" },
{...where id <= length(vegetables)-length(replace(vegetables,',',''))+1;
db.collection.aggregate(
[...{ $unwind : "$vegetables" },
{ $project : { _id: 0, fruits:1, veggies: "$vegetables"...(vegetables,',',''))+1;
db.collection.aggregate(
[
{ $unwind : "$vegetables" },
{...fruits, substring_index(substring_index(vegetables, ',', id),',' ,-1) vegetables
from collection,