Пожалуйста, обратитесь к этой проблеме Здесь
У меня та же проблема, за исключением того, что я не предоставляю никаких геоданных.
Часть реализации геоданных моей модели ниже
startLocation: {
// GeoJSON
type: {
type: String,
default: 'Point',
enum: ['Point']
},
coordinates: [Number],
address: String,
description: String
},
locations: [
{
type: {
type: String,
default: 'Point',
enum: ['Point']
},
coordinates: [Number],
address: String,
description: String,
day: Number
}
]
То же тело запроса для каждого случая ниже
{
"name": "The Test Tourxx",
"duration": 1,
"maxGroupSize": 1,
"difficulty": "medium",
"price": 501,
"summary": "Nothing exciting here man!",
"imageCover": "tour-3-cover.jpg",
"ratingsAverage": 4,
"guides": ["5e85e24bd1b3f918dc07bb3d", "5e85e262d1b3f918dc07bb3e"]
}
Ответ при подключении локальной MongoDB ниже
{
"status": "error",
"error": {
"driver": true,
"name": "MongoError",
"index": 0,
"code": 16755,
"errmsg": "Can't extract geo keys: { _id: ObjectId('5e85fc64a4031f1734b55515'), startLocation: { type: \"Point\", coordinates: [] }, ratingsAverage: 4, ratingsQuantity: 0, rating: 4.5, images: [], createdAt: new Date(1585839200315), startDates: [], secretTour: false, guides: [ ObjectId('5e85e24bd1b3f918dc07bb3d'), ObjectId('5e85e262d1b3f918dc07bb3e') ], name: \"The Test Tourxx\", duration: 1, maxGroupSize: 1, difficulty: \"medium\", price: 501, summary: \"Nothing exciting here man!\", imageCover: \"tour-3-cover.jpg\", locations: [], slug: \"the-test-tourxx\", __v: 0 } Point must only contain numeric elements",
"statusCode": 500,
"status": "error"
},
"stack": "MongoError: Can't extract geo keys: { _id: ObjectId('5e85fc64a4031f1734b55515'), startLocation: { type: \"Point\", coordinates: [] }, ratingsAverage: 4, ratingsQuantity: 0, rating: 4.5, images: [], createdAt: new Date(1585839200315), startDates: [], secretTour: false, guides: [ ObjectId('5e85e24bd1b3f918dc07bb3d'), ObjectId('5e85e262d1b3f918dc07bb3e') ], name: \"The Test Tourxx\", duration: 1, maxGroupSize: 1, difficulty: \"medium\", price: 501, summary: \"Nothing exciting here man!\", imageCover: \"tour-3-cover.jpg\", locations: [], slug: \"the-test-tourxx\", __v: 0 } Point must only contain numeric elements\n at Function.create (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\core\\error.js:43:12)\n at toError (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\utils.js:149:22)\n at C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\operations\\common_functions.js:265:39\n at handler (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\core\\sdam\\topology.js:913:24)\n at C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\cmap\\connection_pool.js:352:13\n at handleOperationResult (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\core\\sdam\\server.js:487:5)\n at MessageStream.messageHandler (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\cmap\\connection.js:270:5)\n at MessageStream.emit (events.js:311:20)\n at processIncomingData (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\cmap\\message_stream.js:144:12)\n at MessageStream._write (C:\\Users\\Cody\\Desktop\\X-Files\\NodeJS\\4-natours\\node_modules\\mongodb\\lib\\cmap\\message_stream.js:42:5)\n at doWrite (_stream_writable.js:441:12)\n at writeOrBuffer (_stream_writable.js:425:5)\n at MessageStream.Writable.write (_stream_writable.js:316:11)\n at Socket.ondata (_stream_readable.js:714:22)\n at Socket.emit (events.js:311:20)\n at addChunk (_stream_readable.js:294:12)"
}
Ответ при подключении к атласу MongoDB (Удалено несвязанное зелье) ниже
{
"status": "success",
"data": {
"tour": {
"startLocation": {
"type": "Point",
"coordinates": []
},
"ratingsAverage": 4,
"images": [],
"guides": [
"5e85e24bd1b3f918dc07bb3d",
"5e85e262d1b3f918dc07bb3e"
],
"_id": "5e85fb952754013728fc950c",
"name": "The Test Tourxx",
"duration": 1,
"maxGroupSize": 1,
"difficulty": "medium",
"price": 501,
"summary": "Nothing exciting here man!",
"imageCover": "tour-3-cover.jpg",
"locations": [],
"__v": 0,
}
}
}
Как видно, локальная ошибка выдает db при создании пустого массива для "местоположений", но Atlas делает это просто отлично. Пожалуйста, помогите мне определить причину.
Пн goose: 5.9.7 Макет goose: Не используется в проекте MongoDB: 4.2.3 (Local и Atlas оба)