A bit new to Mongo here. I want to return a subset of a collection using find(), but from a specified "starting point". I have a dictionary-like list of documents that I return in chunks and in alphabetical order via the sort
and limit
parameters, but it always starts at the beginning of the collection.
I want to be able to add a "starts with" parameter to the find() method so that, for example, if I queried the letter "h" it would return all documents but with the first one returned being the first document starting with "h". Using next() would eventually return documents starting with "i", "j", "k", and so on. I also haven't been able to find any uses or hacks to allow for a "previous()" method that does the opposite of next(). I'd like to use "previous()" (or whatever it may be called), to return documents starting with "g", "f", all the way back to the beginning of the collection.
Am I barking up the right tree? This seems like a pretty obvious function of a database, but I haven't found any examples or other mention of using Mongo like this.