How can I get to the raw json returned by a query

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I'm interested in getting the raw json from my queries:
      I have the following simple code:

      db = new Mongo().getDB("myDatabase");
      DBCollection coll = db.getCollection("myCollection");
      DBCursor cursor = coll.find();

      And "String raw = cursor.next().toString();" will allow me to get the raw json for my query.

      However getDB() is deprecated and as far as I can tell the new getDatabase() line of API calls convert the json results to java objects automatically.

      My question is, how can I get to the raw json returned by a query using the getDatabase() line of API calls like I used to?

      Thanks

            Assignee:
            Unassigned
            Reporter:
            Emrah Diril
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: