func changeAndUpdateTransaction(t *testing.T, transaction *dbmodels.Transaction) { transaction.PayerID = bson.NewObjectId() transaction.ReceiverID = bson.NewObjectId() transaction.Type = models.TransactionTypeCard transaction.Currency = "USD" err := UpdateTransaction(transaction) if err != nil { t.Fatal("The transaction document could not be updated!") } }