Answer the question
In order to leave comments, you need to log in
Sorting in MongoDB?
Hello. I've been scratching my head with sorting for a day now. There is a document:
user:{
type: Schema.ObjectId,
ref: 'User',
required: true,
index: true
},
title:{
type: String
},
txt:{
type: String
},
created:{
type: Date,
default: Date.now
},
reposts: [{
user: {
type: Schema.Types.ObjectId,
ref: 'User',
index: true
},
created: {
type: Date,
default: Date.now
}
}]
a = {
user:"Вася",
title:"Привет",
txt:"Привет мир",
created:"29-10-2014",
reposts:[]
}
b = {
user:"Вася",
title:"Привет",
txt:"Привет мир",
created:"29-11-2014",
reposts:[]
}
c = {
user:"Петя",
title:"Привет",
txt:"Привет мир",
created:"29-09-2014",
reposts:[
user:"Вася",
created:"29-12-2014"
]
}
b = {
user:"Вася",
title:"Привет",
txt:"Привет мир",
created:"25-11-2014",
reposts:[]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question