0
我想通過使用對象ID來查找文檔。但是,即使對象ID是正確的,也沒有結果。這是我的java代碼。在MongoDB中查詢文檔的_id
ObjectId id = (ObjectId)request.getParameter("id");
MongoCollection collection = db.getCollection("source");
BasicDBObject whereQuery = new BasicDBObject();
whereQuery.put("_id",id);
我相信我需要改變whereQuery.put()。
謝謝!有用 –