1
Java를 사용하여 데이터베이스에서 mongo "_ids"목록을 가져 오려고합니다. 데이터베이스의 다른 부분은 필요 없으며 "_id"만 있습니다. ...mongo 데이터베이스에서 _ids 검색
이// Another method queries for all objects of a certain type within the database.
Collection<MyObject> thingies = this.getMyObjects();
Collection<String> ids = new LinkedList<String>();
for (MyObject thingy : thingies) {
ids.add(thingy.getGuid());
}
이 비록 끔찍하게 비효율적 인 것처럼 보인다 그들의 "_ids"특정 유형의 개체에 대한 몽고를 조회하고 반환하는 방법이있다 :
이
내가 지금 뭘하는지입니다 전체 객체를 재조합하고 추출하지 않고도?감사합니다.
[자바 MongoDB의에서 필드의 하위 집합을 가져]의 중복 가능성 (http://stackoverflow.com/questions/10714939/retrieving-a-subset-of -fields-mongodb-in-java) – WiredPrairie