I have the following collection:
// SUSPEITOS - INICIO //
const suspeitosSchema = new mongoose.Schema({
nome: { type: String },
sexo: { type: String },
corPele: { type: String },
altura: { type: String },
peso: { type: String },
tamanhoCabelo: { type: String },
corCabelo: { type: String }
})
// ACOES //
const acoesSchema = new mongoose.Schema({
dataCadastro: { type: Date, default: Date.now },
fonte: { type: String },
bo: { type: String },
numeroBo: { type: Number },
imagem: { type: String },
relato: { type: String },
modus: { type: String },
falhasApuradas: { type: String },
dataOcorrencia: { type: Date },
latitude: { type: String },
longitude: { type: String },
suspeitos: [suspeitosSchema]
})
I need to register a json that I get from a form via POST, registering it is, however, I'm using a multi-select ( link ) and the return of it is another json, as you can see below:
WhenIsubmittheformthroughPOST,itregisters,butthedatathatcamefromtheMultiselectJSONregistersasfollows,noticetheitems" source " and " suspects ":
{
"_id" : ObjectId("5a04a17af7a3373fe007cbca"),
"fonte" : "[object Object],[object Object],[object Object]",
"eventosDeRisco" : [
],
"acoesCriminosas" : [
],
"alertas" : [
],
"veiculos" : [
],
"suspeitos" : [
{
"nome" : "[object Object],[object Object]",
"_id" : ObjectId("5a04a17af7a3373fe007cbcb")
}
],
"dataCadastro" : ISODate("2017-11-09T18:42:02.842+0000"),
"__v" : NumberInt(0)
}