Conversion from String to MongoDB ObjectID

前端 未结 5 1494
情深已故
情深已故 2021-01-20 09:18

I tried converting my String ID to MongoDB ObjectID

public class relevancy_test extends  Object implements Comparable {
    public static voi         


        
5条回答
  •  旧巷少年郎
    2021-01-20 09:54

    While retrieving from List cast it directly to ObjectId

     for (DBObject postObj : dbobj) {
            ObjectId objId = (ObjectId)postObj.get("_id");
            updateMap.put(objId, postObj);
    }
    

提交回复
热议问题