А как модель выглядит сама?
`
const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate');
const Schema = mongoose.Schema;
const model = 'Rides';
const schema = new Schema({
userId: Schema.ObjectId,
userPhoneNumber: String,
driverUserId: {
type: Schema.Types.ObjectId,
},
requestedDrivers: [],
status: String,
searchId: String,
cancel: {
tag: String,
notes: String,
},
pickUp: {
location: {
type: String,
coordinates: [Number],
},
address: String,
date: Date,
},
dropOff: {
location: {
type: String,
coordinates: [Number],
},
address: String,
date: Date,
},
requestedDropOff: {
location: {
type: String,
coordinates: [Number],
},
address: String,
date: Date,
},
requestedPickup: {
iso3166: String,
location: {
type: String,
coordinates: [Number],
},
address: String,
date: Date,
},
tripData: [{
status: String,
speed: Number,
heading: Number,
altitude: Number,
location: {
type: String,
coordinates: [Number],
},
timestamp: String,
}],
tripDataLive: [{
status: String,
speed: Number,
heading: Number,
altitude: Number,
location: {
type: String,
coordinates: [Number],
},
timestamp: String,
}],
tripDataEstimated: [{
status: String,
speed: Number,
heading: Number,
altitude: Number,
duration: Number,
distance: Number,
location: {
type: String,
coordinates: [{
latitude: Number,
longitude: Number,
}],
},
timestamp: String,
}],
ratings: {
driver: {
value: Number,
feedback: String,
},
user: {
value: Number,
feedback: String,
},
},
location: {
type: String,
coordinates: [Number]
},
totalsEstimated: {
distance: Number,
duration: Number,
totalFrom: Number,
totalTo: Number,
},
totalType: {
type: String,
enum: ['realDistanceMismatch', 'realCoordinatesMismatch', 'estimated'],
},
totals: {
cost: {
perDistance: Number,
perDuration: Number,
base: Number,
tax: Number,
total: Number,
},
iso4217: String,
distance: Number,
duration: Number,
paid: Boolean,
method: String,
notes: String,
},
createdAt: {
typeKey: Date,
},
updatedAt: {
typeKey: Date,
},
}, {
typeKey: '$type',
timestamps: true,
});
module.exports = mongoose.models[model] || mongoose.model(model, schema);
``