The $lookup Stage, is Datatype matters beteen Joining columns/attributes?

  • Just completed The $lookup Stage. Had doubt that - is Datatype matters beteen Joining columns/attributes i.e. between localField and foreignField?
  • Even I will give a try for same and check, for my satisfaction.

That’s the best way to learn.

1 Like

Hi @VINAYAKA_05231,

The $lookup stage uses equality condition to join the collections. So, the data type of localField and foreignField should be similar (If the datatype is not same, error will not be thrown but there won’t be any desired result).

Please refer to the following documentation for more information with Examples:

Please let me know, if you have any questions.


Yes, Just gave a try on 2 simple collections. Got expected result only on datatype match.
Thank you…

Aren’t you going to share your “expected results”? :slight_smile: