I have a collection Posts
and each post has a title and an author.
Posts : {
id : 7867887687,
title : unnamed-1,
author : joe
},{
id : 2867887687,
title : unnamed-2,
author : joe
},{
id : 1867337687,
title : happyhour,
author : joe
},{
id : 2367337687,
title : crappyhour,
author : deb
}
I want to return a cursor with only the posts by joe that have a title unnamed*. The next step is to sort the unnamed posts and add a new unnamed post with the next available -x number. (if one had been previously deleted the next available -x might be in the middle of others ... (sort of like creaiting new folders in windows))
How would I do that in Mongo?
Or should I return all posts by joe and then do a forEach to find the unnamed ones somehow?
Or some other method?