Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2116

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            ediril Emrah Diril
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: