Relationship not working on Production Mode

When I setup forest admin on my local machine than the smart relationship are working properly.But when I setup forest admin on Production mode on AWS server than it is not showing me the foreign key data.Can some body please help

Hi @rohit_ja :wave:

  • Could you check if you have any errors in your backend application (AWS server)?
  • Could you also share the project name, the model name and the smart relationship name?

yes I have checked that I am not seeing any error on backend.
Vollie Admin is the project name. Model Name is ‘Companies’ and the model with which I need to connect is ‘users’
I am using this line of code to connect
‘ownerId’: { type: mongoose.Schema.Types.ObjectId, ref: ‘users’ },

1 Like

Hello @rohit_ja !
Can you share with me the file in which the smart relationship is defined ?
Did you take a look at the documentation ?

Hi @anon94532230 yes i have seen the documnetation and the code is working properly on my local serve but I am facing this issue on my live server (AWS)

Do you have any error in your browser and/or server logs ?
Can I see the model definition in your forest backend ?
Did you recently upgrade your forest-express-mongoose package ?

No there is no error neither in browser nor in backend console

What about those questions ?

// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
const mongoose = require('mongoose');

// This section contains the properties of your model, mapped to your collection's properties.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const schema = mongoose.Schema({
  '_id': String,
  'about': String,
  'address': String,
  'companyName': String,
  'createdAt': Date,
  'departments': [{
    name: String,
    label: String,
    _id: false,
  }],
  'fontColor': String,
  'heroColor': String,
  'name': String,
  'navbarColor': String,
  'navbarTagline': String,
  'navigationBarLogo': String,
  'ownerId': { type: mongoose.Schema.Types.ObjectId, ref: 'users' },
  'profileLogo': String,
  'secondaryNavbarColor': String,
  'serverCauses': [String],
  'title': String,
  'updatedAt': Date,
}, {
  timestamps: false,
});

module.exports = mongoose.model('companies', schema, 'Companies');

No I havenot updated the orest-express-mongoose package

Ok, this looks like a relationship not a smart relationship.
Is there any difference between your .forestadmin-schema.json on your local and remote environments ? (You should find this file at the root of the lumber generated directory).

Thanks @anon94532230 it is done