I have this schema with mongoose
schema = new Schema({ id: { type: String, }, embedded: [embeddedSchema] });
embeddedSchema = new Schema({ value: { type: String, }, });
This can produce something like :
{
"_id" : ObjectId("5454f4f1073cc3b529320f79"),
"embedded" : [
{
"value" : 123,
} {
"value" : 123,
}
{
"value" : 123423,
}
],
}
/* 1 */
{
"id" : ObjectId("5454f508910ef3b82970f11d"),
"embedded" : [
{
"value" : 1,
} {
"value" : 2,
}
{
"value" : 9999999,
}
}
I would to sort the schema collection by the biggest value of embedded doc. Which query can produce this kind of result ?
Thanks you!
Aucun commentaire:
Enregistrer un commentaire