Mongoose type schema referencing through axios

In my API I have a model called invoice. Basically this API is for a hotel system

var schema = mongoose.Schema({
        invId: String,
        dateTime: Date,
        username: String,
        payMethod: ["CASH", "VISA", "MASTER_CARD", "AMEX", "ONLINE"],
        totDiscount: Number,
        totValue: Number,
        contactNumber: { type: mongoose.Schema.Types.Mixed, ref: 'customer' },
        hotelCode: String,
        reservation: [{ type: mongoose.Schema.Types.Mixed, ref: 'reservation' }],
        _active: Boolean
    }, { timestamps: true });

This is running on port 8098.Above in the code there is an attribute called contact number. And it is referenced to a model called customer.

contactNumber: { type: mongoose.Schema.Types.Mixed, ref: 'customer' }

But my customer controller is in another module.That module is running on port 8099.Here I want to reference this customer model through axios.(To the contact number)

customerUrl: "http://localhost:8099/api/customer"

Above link is the url for customer module.Can someone help me with this issue?



Read more here: https://stackoverflow.com/questions/66997753/mongoose-type-schema-referencing-through-axios

Content Attribution

This content was originally published by Default at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: