I have 2 collections : Transactions & Accounts.
I need to join Accounts to Transactions so I can group on the Accounts.acctType field. The problem is that Transactions.accountId is of type 'string' and Accounts._id is of type 'Int32'.
is there any way to get around this problem without having to change the Transactions.accountId type?
Current lookup code:
$lookup: {
from: 'accounts',
localField: accountId,
foreignField: '_id',
as: 'accountData'
}
What I need:
$lookup: {
from: 'accounts',
localField: Number(accountId), //something like this
foreignField: '_id',
as: 'accountData'
}
Or:
$lookup: {
from: 'accounts',
localField: accountId,
foreignField: '_id.toString()', //or something like this
as: 'accountData'
}
