Answer the question
In order to leave comments, you need to log in
How to add an array to the end of a document?
const testsSchema = mongoose.Schema({
test: {
id: Number,
name: String,
usings: [ Number ]
}
}, { versionKey: false })
const tests = new test({
test: {
id: count + 1,
name: name,
usings: []
}
})
return tests.save()
Answer the question
In order to leave comments, you need to log in
On your client, you can try sorting through Object.keys.
But for the sake of aesthetics, it's not worth it, and in cases where it seems to you that it is the order in the object keys that is needed, often this is due to poor design of the structure of documents / objects / classes, and it is better to reconsider the structure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question