Im trying to read a (mongo)userdatabase with java. On the tutorial page I saw how to read the whole collection. I can do something like that:
DBCursor cursor = col.find();
while (cursor.hasNext()) {
System.out.println(cursor.next());
}
Now if I have a collection with users := name, age, password (...) and whatever. Now I would like to find a name with a password. For example for a login process. Lets say I have two strings: String n and p. If there is a user.equals(n) and a password.equals(p) in the database then login user. How do I have to change my cursor? I saw some query examples on the mongodb java tutorial page, but duh I really dont get it...
Any ideas? Thank you