MongoDB C++ 드라이버가 머리를 쓰고 있습니다. 프로그램 컴파일을 중지시키는 아래 쿼리를 제외하고 모든 쿼리에 올바르게 작동하는 작동하는 드라이버가 있습니다.MongoDB C++ 드라이버 쿼리 오류
코드는 여기 MongoDB를 문서에 따라 작동합니다 : http://docs.mongodb.org/ecosystem/drivers/cpp-to-sql-to-mongo-shell/
의도는 콜렉션에있는 모든 문서의 단지 "이름"필드를 선택하는 것입니다. 내가 매개 변수가 일치 호출 제안 된 후보를 만드는 생각,하지만 다른 오류가 발생 성공할 수있는 모든 것을 시도
error: no matching function for call to ‘mongo::DBClientConnection::query(const char [19], mongo::Query, int, int, mongo::BSONObj)’
mongodriver/include/mongo/client/dbclientinterface.h:1274: note: candidates are: virtual std::auto_ptr<mongo::DBClientCursor> mongo::DBClientConnection::query(const std::string&, mongo::Query, int, int, const mongo::BSONObj*, int, int)
:
using namespace std;
using namespace mongo;
DBClientConnection c;
c.connect("localhost");
auto_ptr<DBClientCursor> cursor = c.query("db.coll", Query(), 0, 0, BSON("name" << 1));
//auto_ptr<DBClientCursor> cursor = c.query("db.coll", Query().sort("_id", -1), 0, 0);
//auto_ptr<DBClientCursor> cursor = c.query("db.coll", Query());
//auto_ptr<DBClientCursor> cursor = c.query("db.coll", QUERY("type" << "blog"));
그러나, 나는 다음과 같은 오류가 발생합니다. 주석 처리 된 쿼리가 모두 올바르게 작동합니다. 실망. 어떤 통찰력 사전에
감사합니다.
네, 실제로 문제가있었습니다. 나는 당신을 투표 할 것이지만 필요한 대표를 가지고 있지 않아요, 미안 해요! – mjhall