본문 바로가기

Database/MongoDB7

qt symbol lookup error(mongodb-c-driver ) 해결 1. gcc에서도 안된다면 pkg-config가 pc파일을 보고 컴파일 해주기 때문에 libmongoc-1.0.pc파일을 찾습니다. 이게 없거나 설정이 잘 못 되어 있을 수 있습니다.없다면 다운 받은 mongo-c-driver/src 에 있습니다. 2. gcc -o find-specific find-specific.c $(pkg-config --cflags --libs libmongoc-1.0) // 는 되지만 qt에서 symbol look up error를 뱉어 낸다면 따라하세여.qt에서 실행할때 경로를 잘 못 지정하여 /home/choi/build-mongo-Desktop-Debug/mongo: symbol lookup error: /home/choi/build-mongo-Desktop-Debug/m.. 2017. 2. 18.
c언어 mongdb_mongodb 명령어 사용(insert,find 등) #include #include #include int main (int argc, char *argv[]){ mongoc_client_t *client; mongoc_collection_t *collection; bson_error_t error; bson_oid_t oid; struct tm born = { 0 }; bson_t *document; born.tm_year = 6; born.tm_mon = 11; born.tm_mday = 9; mongoc_init (); client = mongoc_client_new ("mongodb://localhost:27017"); collection = mongoc_client_get_collection (client, "attendance", "userli.. 2017. 2. 17.
c언어 mongodb_document 구성 Document 구성 방법BSON 또는 BCON을 이용할 수 있다.BCON이 더 직관적이고 가독성이 높기 때문에 BCON을 이용한다.JSON을 파싱할 또는 이용하여 만들 때는 BSON을 이용 하는듯 하다. 만들 예재:{ born : ISODate("1906-12-09"), name : { first : "Grace", last : "Hopper" }, languages : [ "MATH-MATIC", "FLOW-MATIC", "COBOL" ], degrees: [ { degree: "BA", school: "Vassar" }, { degree: "PhD", school: "Yale" } ] } #include int main (int argc, char *argv[]){ struct tm born = {.. 2017. 2. 17.
c언어 mongodb 연동 다음 코드를 실행하면 설정한 db의 collection에 hello:world(키:값) 을 추가 해준다. #include #include #include #include int main (int argc,char *argv[]){ mongoc_client_t *client; // DB주소를 담을 변수 mongoc_database_t *database; // DB이름을 담을 변수 mongoc_collection_t *collection; // collection 이름을 담을 변수 bson_t *command, // mongodb에서 사용할 명령어 reply, *insert; bson_error_t error; char *str; bool retval; mongoc_init (); // mongoc 시작(제.. 2017. 2. 17.