I have 2 columns String id, String Name and long age.
As we would have done in sql - select id FROM USERDETAILS Where Age > 5 would give me arrayList of primary keys that is "Id".
can anyone tell me how to do the same for mongo db using morphia.
I tried with query.retrieveFields(true,"id").get();
but it returns a USERDETAILS Model in return , i need only array of ids. how can i do this please help
You're going to get back your model class with morphia. That's what it does. If you want the raw list of IDs, you'll need to use the driver directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With