0

I am trying to import an object into a mongoose schema, but I am getting an 'unexpected identifier' error. Am I making a syntax error or not, I am not sure how to export.

my exported object


const electronic = {
    title: { type: String },
    description: { type: String },
    price: { type: String },
    location: { type: String },
    image: { type: Array },
    phone: {
        type: String
    },
    email: {
        type: String
    },
    author: {
        type: String,
        ref: 'User'
    }
}

export default electronic

where I import the object

const mongoose = require('mongoose');
import electronic from '../master_objects/electronics'

const electronics = new mongoose.Schema(
    electronic, {
    timestamps: true
});

module.exports = mongoose.model('vancouver_electronic', electronics);
Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75

1 Answers1

1

intead of doing export default electronic ,do module.exports=electronic for more info Getting Unexpected Token Export

Ankush Verma
  • 689
  • 1
  • 8
  • 17