join two collections with mongoose and want to include the quantity field in the result

36 Views Asked by At

My Collections:

users collection

entities collection

My Code:

const user = await User.aggregate().lookup({
      from: 'entities',
      localField: 'cartId.entityId',
      foreignField: '_id',
      as: 'cartId.entityId',
    });

Result:

Result

My Problem: I want quantity exist in result but it's not. What I can do?

0

There are 0 best solutions below