when ever i make a post request it returns only the created date and the objectID
всякий раз, когда я делаю запрос на публикацию, он возвращает только созданную дату и objectID, когда я делаю запрос на публикацию, он возвращает только созданную дату и objectID, когда я делаю запрос на публикацию, он возвращает только созданноедата и идентификатор объекта
i tried testing it with postman but it was the same thing
//this is the controller for creating a new room
exports.create_a_room = function(req, res) {
let new_room = new Room(req.body);
new_room.save(function(err, task) {
if (err) res.send(err);//testing for errors
res.json(task);
});
};
//this is the schema for the Rest api.the created date is the the only one working
var RoomSchema = new Schema({
full_name: {//for full name
type: String,
Required: 'Enter first name'
},
time: {//for time
type: String,
Required: 'Enter checkout'
},
people: {//for people
type: Number,
Required: 'Enter people'
},
kids: {for kids
type: Number,
Required: 'Enter kids'
},
room_type: {//for room types
type: String,
Required: 'Enter room type'
},
room_number: {//for room number
type: Number,
Required: 'Enter room Number'
},
Created_date: {for created date.this is the only part of the schema that is actually working
type: Date,
default: Date.now
},
});
it just returns the created date and the objectID generated by mongodb