MongoDB에 해당하는 항목을 DataTable 오브젝트로 반환한다.
MongoDB를 사용하려면 ProxyMongoDB.exe 프로그램이 실행되어 있어야 한다. ( http://files.autobase.biz/FileDownLoad/FileDownLoad.aspx?Folder=Proxy )
object @ProxyMongoFill(int connection_id, string collection_name, string filter, string sort);
함수인자
int connection_id : 접속된 연결 ID
string collection_name : Collection 명
string filter : 필터 문장 (JSON Text)
string sort : 소트 문장 (JSON Text)
반환 값
성공하면 object를 반환하고 실패하면 null 을 반환한다.
예제
connection_id = @ProxyMongoOpen("mongodb://192.168.1.149", "test");
if(connection_id == 0)
{
@Message("Error. connection_id ==
0");
return;
}
string text;
@sprintf(text,
"{PersonCount:50}");
string sort;
@sprintf(sort, "{_id:1}");
object
dt;
dt = @ProxyMongoFill(connection_id, "things", text, sort);
@ProxyMongoClose(connection_id);
if(dt == null)
{
@MessageBox(@GetLastError(), "MongoFill Error", MB_OK);
return;
}
int count;
count = @DataTableGetRowCount(dt);
if(count >
0) {
string data = @DataTableGetRowData(dt, "PersonDate", 0);
string id = @DataTableGetRowData(dt, "_id", 0);
@sprintf(text,
"Count=%d _id=%s, PersonDate=%s", count, id, data);
@Message(text);
}
else {
@sprintf(text, "Count=%d",
count);
@Message(text);
}
@DataGridSetDataTable("DataGrid1", dt);
@DataGridReLoad("DataGrid1");
문장설명 : 192.168.1.149 IP의 test 데이터베이스를 열어서 사용하는 예제
버전정보
최초지원: 10.3.5
관련항목