user3313539
user3313539

Reputation: 133

Get a list of fields in MongoDB Document?

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.

Upvotes: -1

Views: 284

Answers (1)

Anand Jayabalan
Anand Jayabalan

Reputation: 12904

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

Upvotes: 0

Related Questions