DBCollection collection;
public static void main(String[] args) {
MongoClient mongoClient = new MongoClient("localhost" , 27017 );
DB db = mongoClient.getDB("dispatch_location");
DBCollection collection= db.getCollection("locale");
BasicDBObject point = new BasicDBObject();
collection.createIndex(new BasicDBObject("loc", "2d") );
new QueryBuilder ().near(-88.769896, 34.268103);
QueryBuilder query = QueryBuilder.start();
collection.findOne(query);
System.out.println(query);
我得到空指针除了和一位同事告诉我初始化DBCollection我不知道如何初始化