25 #include <IceUtil/UUID.h>
26 #include <mongo/client/dbclient.h>
36 iceId.name = IceUtil::generateUUID();
47 std::unique_lock lock(dbConnectionMutex);
48 return dbConn->count(ns);
53 std::unique_lock lock(dbConnectionMutex);
54 return dbConn->findByMongoId(ns,
id);
58 const std::string& fieldName,
const std::string& fieldValue,
59 const Ice::Current&
c)
61 std::unique_lock lock(dbConnectionMutex);
62 return dbConn->findByFieldValue(ns, fieldName, fieldValue);
66 const std::string& fieldName,
const std::string& fieldValue,
67 const Ice::Current&
c)
69 std::unique_lock lock(dbConnectionMutex);
70 return dbConn->findOneByFieldValue(ns, fieldName, fieldValue);
74 const std::string& fieldName,
const NameList& fieldValueList,
75 const Ice::Current&
c)
77 std::unique_lock lock(dbConnectionMutex);
78 return dbConn->findByFieldValueList(ns, fieldName, fieldValueList);
83 const Ice::Current&
c)
85 std::unique_lock lock(dbConnectionMutex);
86 return dbConn->findOneByQuery(ns, query);
91 std::unique_lock lock(dbConnectionMutex);
92 return dbConn->findByQuery(ns, query);
97 std::unique_lock lock(dbConnectionMutex);
98 return dbConn->findByQuery(ns, query, where);
103 std::unique_lock lock(dbConnectionMutex);
104 return dbConn->findAll(ns);
109 std::unique_lock lock(dbConnectionMutex);
110 return dbConn->findAllUniqueByFieldName(ns, fieldName);
115 std::unique_lock lock(dbConnectionMutex);
116 return dbConn->findAllIds(ns);
121 std::unique_lock lock(dbConnectionMutex);
122 return dbConn->findAllFieldValues(ns, fieldName);
127 std::unique_lock lock(dbConnectionMutex);
128 return dbConn->insert(ns, obj);
133 std::unique_lock lock(dbConnectionMutex);
134 return dbConn->insertList(ns, objectList);
139 std::unique_lock lock(dbConnectionMutex);
140 return dbConn->update(ns, obj,
"_id");
145 std::unique_lock lock(dbConnectionMutex);
146 return dbConn->update(ns, obj, keyField);
151 return dbConn->updateByQuery(ns, query, mongo::fromjson(obj.JSON));
155 const Ice::Current&
c)
157 std::unique_lock lock(dbConnectionMutex);
158 return dbConn->insert(ns, obj,
true);
162 const std::string& keyField,
const Ice::Current&
c)
164 std::unique_lock lock(dbConnectionMutex);
165 return dbConn->update(ns, obj, keyField,
true);
170 std::unique_lock lock(dbConnectionMutex);
171 return dbConn->removeByMongoId(ns,
id);
175 const std::string& fieldValue,
const Ice::Current&
c)
177 std::unique_lock lock(dbConnectionMutex);
178 return dbConn->removeByFieldValue(ns, fieldName, fieldValue);
183 std::unique_lock lock(dbConnectionMutex);
184 return dbConn->removeByQuery(ns, query);
189 std::unique_lock lock(dbConnectionMutex);
190 return dbConn->clearCollection(ns);
195 std::unique_lock lock(dbConnectionMutex);
196 return dbConn->ensureIndex(ns, fieldName, unique);