Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[remove-duplicate-repay-recall-topup] adding unique indexes #302

Conversation

thanhnguyennguyen
Copy link
Contributor

@thanhnguyennguyen thanhnguyennguyen commented Jul 7, 2020

fix #301
As Dropdup option is no longer available since mongo 3.X and later (https://stackoverflow.com/questions/30187688/mongo-3-duplicates-on-unique-index-dropdups). We should run following commands in mongodb to remove duplicated documents before restarting fullnode

# remove duplicated repays
db.lending_repays.find({}, {hash:1, txHash:1}).sort({_id:1}).forEach(function(doc){     db.lending_repays.remove({_id:{$gt:doc._id}, hash:doc.hash, txHash: doc.txHash}); });
	
# remove duplicated topups
db.lending_topups.find({}, {hash:1, txHash:1}).sort({_id:1}).forEach(function(doc){     db.lending_topups.remove({_id:{$gt:doc._id}, hash:doc.hash, txHash: doc.txHash}); });

# remove duplicated recalls
db.lending_recalls.find({}, {hash:1, txHash:1}).sort({_id:1}).forEach(function(doc){     db.lending_recalls.remove({_id:{$gt:doc._id}, hash:doc.hash, txHash: doc.txHash}); });

@thanhnguyennguyen thanhnguyennguyen changed the title [remove-duplicate-repay-recall-topup] adding unique index [remove-duplicate-repay-recall-topup] adding unique indexes Jul 7, 2020
@thanhnguyennguyen thanhnguyennguyen marked this pull request as ready for review July 8, 2020 02:59
@thanhnguyennguyen thanhnguyennguyen changed the base branch from master to release/v2.3.0-beta July 29, 2020 02:27
@thanhson1085 thanhson1085 merged commit 09aee16 into BuildOnViction:release/v2.3.0-beta Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated repay records
2 participants