I am using spring mongo data connector and i have some 40 collections in my database. I want to fetch the last inserted record in entire database and not just specific to a collection.
Asked
Active
Viewed 120 times
0
-
1I don't think you can with a query. Maybe, using a new collection with only one object : each time you insert an object in your 40 collections, you reset this new collection with the last inserted item. – Odonno Jul 30 '16 at 12:33
-
I'd endorse Odonno's proposal. Sounds like a weird requirement, though. If you run a single application instance you might save it there. – Jan B. Jul 30 '16 at 22:53