I have a mongo collection called fruit-data.in there i have document look like this.
{
name:Apple,
weight:100g,
color:red,
other_data:{
havested_by:Jhone,
havested_from:Rileys Farm,
city: Oak Glen, California,
country:USA
}
}
I want to remove the nested object and get that data to the same level. using mongo migration. I'm using migrate-mongo library.
{
name:Apple,
weight:100g,
color:red,
havested_by:Jhone,
havested_from:Rileys Farm,
city: Oak Glen, California,
country:USA
}
The only thing I know. I have to write up() function this. I'm very new to backend.is there mongo specific way to do this?
I have managed to write up a function that looks like this.
up(db, client) {
return db.collection('fruit-data')
}