Aggregation on collection that holds pointers to other collections

I am trying to write an aggregation on one of my collections which has a bunch of pointers stored into it.

When I try to build the aggregation using compass, I cant seem to make it work properly.

[
  {
    '$lookup': {
      'from': 'TokenMetaData', 
      'localField': '_p_token0', 
      'foreignField': '_id',  //with _id I dont get anything back, with objectId I get all the Tokenmetadatas back for each document instead of just the pointer reference document
      'as': 'token0'
    }
  }, {
    '$match': {
      '_created_at': {
        '$gt': new Date('Wed, 20 Apr 2022 18:20:53 GMT')
      }
    }
  }, {
    '$group': {
      '_id': {
        'token0': '$_p_token0.symbol', 
        'token1': '$_p_token1.symbol'
      }, 
      'usd': {
        '$sum': '$token0_usd_value'
      }
    }
  }
]

you may need to use iso string here, like { $lte : new Date("2022-12-29T00:00:00Z").toISOString() }

the date part is working correctly the way I have it. I just cant seem to get it to work that I can lookup the pointer values correctly.

did you try with simple id: 'foreignField': 'id'?

yea I tried _id id objectId none of them worked

I don’t know how to help in this case.