I would like to know if there is a better way to copy data from an api collection to another.Basically I would like to get data from one collection and post it in another collection
I am looking for a better way to do it than I correctly doing
get from collection A
{
"_id": {
"$oid": "614d3cedfb2600340fdb28f9"
},
"date": "2021-09-23",
"title": "First test",
"description": "Going",
}
I like to post in collection b
return await axios
.get(url.rest_api + '/template', {
params: {
owner: 'abc123',
},
})
.then(response => {
axios
.post(url.rest_api + '/todos', response.data)
.then(function (response) {
console.log(response)
})
.catch(function (error) {
// handle error
console.warn(error.message);
})
})
.catch(err => {
console.log(err);
});