lookup static method

Map<String, Object> lookup({
  1. required String from,
  2. required String localField,
  3. String foreignField = '_id',
  4. String? as,
})

Implementation

static Map<String, Object> lookup({
  required String from,
  required String localField,
  String foreignField = '_id',
  String? as,
}) {
  if (as == null) {
    as = '${from}_info';
  }

  return {
    '\$lookup': {
      'from': "$from",
      'localField': "$localField",
      'foreignField': "$foreignField",
      'as': "$as"
    }
  };
}