public static void main(String[] args) throws UnknownHostException {
        MongoClient client =  new MongoClient();
        DBCollection collection = client.getDB("course").getCollection("findTest");

        DBObject doc = new BasicDBObject();
        Random random = new Random();
        List<DBObject> docs = new ArrayList<DBObject>();

        collection.drop();

        for (int i = 0; i < 7; i++) {
            doc.removeField("_id");
            doc.put("x", random.nextInt(100));
//            docs.add(doc);
            collection.insert(doc);
        }

//        collection.insert(docs);

        System.out.println("\n findOne :"+collection.findOne());

        printElementByIndex(collection, 3, false);

        showCollection(collection, false);

        System.out.println("\n count: "+collection.count());

    }