Need a simple Fetch All Data from a collection using "mongo-java-driver-3.1.0" API

134 views
Skip to first unread message

KARTHIK SHIVAKUMAR

unread,
Nov 26, 2015, 7:13:56 AM11/26/15
to mongodb-user

  Hi

   Spec : jdk1.7, Mongodb 3.x Windows- 64 bit

   I am a newbiand request anybody to refer me URL or Snippet of example code on using "mongo-java-driver-3.1.0" API for the following
  

    I have a collection as shown in the image and need to fetch all of the Data using a cursor.



   This is what i have done  using 'MongoDatabase' API i have the connection ready with Host/port

  
  MongoDatabase database = client.getDatabase("DB");
  MongoCollection<Document> collection = database.getCollection("SSS");
 
   I need to fetch and display all the data using system.out.println .... ?????? How to proceed.


with regards
Karthik
  
Auto Generated Inline Image 1

Chris De Bruyne

unread,
Nov 26, 2015, 7:53:54 AM11/26/15
to mongodb-user
You'll find all your answers right here http://mongodb.github.io/mongo-java-driver/3.0/driver/getting-started/quick-tour/

Kind regards
Chris
Reply all
Reply to author
Forward
0 new messages