Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Convert MongoDB 'DBobject' to Json

$
0
0

Hi.
I'm using the MongoDB java driver to pull some data out of a MongoDB collection. I'm having problems converting the resultant DBObject into a processing JSON object. My code looks a little bit like this:

    BasicDBObject query = new BasicDBObject("s__UID","123456789");
        cursor = coll.find(query);

        while(cursor.hasNext())
        {
         println(cursor.hasNext());
         json = getJSONObject(cursor.next());
        }
        cursor.close();

The Println of cursor.hasNext works fine, but getJSONObject (or loadJSONObject) complain because I'm not passing in strings.

Can anyone help?


Viewing all articles
Browse latest Browse all 2896

Trending Articles