Timeline for Getting next and previous document
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 1, 2013 at 14:37 | comment | added | Anas | Did you actually try my comment ? | |
Apr 1, 2013 at 12:30 | comment | added | Real Dreams | "When creating an index, the number associated with a key specifies the direction of the index. The options are 1 (ascending) and -1 (descending). Direction doesn’t matter for single key indexes or for random access retrieval but is important if you are doing sort queries on compound indexes." docs.mongodb.org/manual/core/indexes | |
Apr 1, 2013 at 12:24 | comment | added | Anas | In your case you should use indexes with direction. Try to insert db.words.insert({word: "aa"}), and then try to look for the previous word of 'b', you will get 'a' not 'aa'. | |
Apr 1, 2013 at 11:49 | history | answered | Anas | CC BY-SA 3.0 |