How to write meteor migration script to insert one collection data to another collection?


#1

i need to insert one collection data to another collection. how can i write migration script for this purpose. card payments and corporate customer payment are two collections.

corporate customer payment collection has below attributes customerID,outsTanding,date,amount,headOfficeId,insertDate

cards payment collection has below attributes customerID,amount,card,packageId,cardId,classType,expireDate,headOfficeId,insertDate

i’m inserting cards payment collection following datas to corporate customer payment collection.

CustomerID -> card.customerID

outsTanding -> card.cartId

date -> card.insertDate

amount -> card.amount

headOfficeId ->card.headOfficeId

so how can i apply this change for old datas. how need i write meteor migration for up and down functions. anyone who had this issue assist me. thanks


#2

There is an Atmosphere package that may help you.

https://atmospherejs.com/percolate/migrations

“A simple migration system for Meteor supporting up/downwards migrations and command line usage.”

Hope that helps!


#3

Use Studio 3T which is a mongo editor.

You can right click a field, and rename the field for the entire database based on the current query.