I'm a beginner in the MEAN world, and I hope to progress quickly thanks to the StackOverflow community.
Here is my problem: I want to retrieve all the information contained in 2 models thanks to 2 fields. Here are my templates :
module.exports = mongoose => {
    var schema = mongoose.Schema(
      {
        fieldA: String,
        fieldB: String,
        fieldC: String,
        fieldD: String,
        fieldE: String
      },
      { timestamps: true }
    );
    schema.method("toJSON", function() {
      const { __v, _id, ...object } = this.toObject();
      object.id = _id;
      return object;
    });
    const ModelA = mongoose.model("ModelA", schema);
    return ModelA;
  };
  module.exports = mongoose => {
    var schema = mongoose.Schema(
      {
        field1: String,
        field2: String,
        field3: String,
        field4: String,
        field5: String
      },
      { timestamps: true }
    );
    schema.method("toJSON", function() {
      const { __v, _id, ...object } = this.toObject();
      object.id = _id;
      return object;
    });
    const ModelB = mongoose.model("ModelB", schema);
    return ModelB;
  };
I want to retrieve in my controller, all the fields of modelA and modelB where modelA.fieldA = modelB.field4 AND modelA.fieldD=modelB.field1
I can't figure out how to code the controller to solve my problem :
const db = require("../models");
const ModelA = db.modelA;
const ModelB = db.modelB;
exports.findAll = (req, res) => {
  ModelA.find()
    .then(data => {
      res.send(data);
    })
    .catch(err => {
      res.status(500).send({
        message:
          err.message || "Some error occurred while retrieving customers."
      });
    });
};
Thank you for your help.