-1

Is it possible to get a list of all the fields in a DBObject? I have searched through the documentation and can't find anything. Thanks.

user3313539
  • 103
  • 1
  • 2
  • 5
  • 1
    What do you mean? You can get all the keys with keySet() and all the values with get(key). A list of keys or values is not useful in logical context since the key/value -pairs shouldn't be in any particular order. – t-my Mar 01 '14 at 17:53

1 Answers1

0

BasicDBObject implements the java.util.Map interface. So, you can use the Map's keySet() method to get the list of keys (or "fields").

Anand Jayabalan
  • 12,294
  • 5
  • 41
  • 52