@@ -71,7 +71,7 @@ public function findOne(string $namespace, array $filter = [], array $options =
7171 * @var $collection MongodbConnection
7272 */
7373 $ collection = $ this ->getConnection ();
74- return $ collection ->executeFindOne ($ namespace , $ filter , $ options );
74+ return $ collection ->execFindOne ($ namespace , $ filter , $ options );
7575 } catch (\Exception $ e ) {
7676 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
7777 }
@@ -93,7 +93,7 @@ public function findAll(string $namespace, array $filter = [], array $options =
9393 * @var $collection MongodbConnection
9494 */
9595 $ collection = $ this ->getConnection ();
96- return $ collection ->executeFindAll ($ namespace , $ filter , $ options );
96+ return $ collection ->execFindAll ($ namespace , $ filter , $ options );
9797 } catch (\Exception $ e ) {
9898 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
9999 }
@@ -132,14 +132,14 @@ public function findPagination(string $namespace, int $limit, int $currentPage,
132132 * @return array
133133 * @throws MongoDBException
134134 */
135- public function fetchOne (string $ namespace , array $ filter = [], array $ options = []): array
135+ public function findOneId (string $ namespace , array $ filter = [], array $ options = []): array
136136 {
137137 try {
138138 /**
139139 * @var $collection MongodbConnection
140140 */
141141 $ collection = $ this ->getConnection ();
142- return $ collection ->executeFetchOne ($ namespace , $ filter , $ options );
142+ return $ collection ->execFindOneId ($ namespace , $ filter , $ options );
143143 } catch (\Exception $ e ) {
144144 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
145145 }
@@ -154,21 +154,19 @@ public function fetchOne(string $namespace, array $filter = [], array $options =
154154 * @return array
155155 * @throws MongoDBException
156156 */
157- public function fetchAll (string $ namespace , array $ filter = [], array $ options = []): array
157+ public function fetchAllId (string $ namespace , array $ filter = [], array $ options = []): array
158158 {
159159 try {
160160 /**
161161 * @var $collection MongodbConnection
162162 */
163163 $ collection = $ this ->getConnection ();
164- return $ collection ->executeFetchAll ($ namespace , $ filter , $ options );
164+ return $ collection ->execFindAllId ($ namespace , $ filter , $ options );
165165 } catch (\Exception $ e ) {
166166 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
167167 }
168168 }
169169
170-
171-
172170 /**
173171 * 返回满足filer的分页数据(_id自动转对象)
174172 *
@@ -180,14 +178,14 @@ public function fetchAll(string $namespace, array $filter = [], array $options =
180178 * @return array
181179 * @throws MongoDBException
182180 */
183- public function fetchPagination (string $ namespace , int $ limit , int $ currentPage , array $ filter = [], array $ options = []): array
181+ public function findPaginationId (string $ namespace , int $ limit , int $ currentPage , array $ filter = [], array $ options = []): array
184182 {
185183 try {
186184 /**
187185 * @var $collection MongodbConnection
188186 */
189187 $ collection = $ this ->getConnection ();
190- return $ collection ->execFetchPagination ($ namespace , $ limit , $ currentPage , $ filter , $ options );
188+ return $ collection ->execFindPaginationId ($ namespace , $ limit , $ currentPage , $ filter , $ options );
191189 } catch (\Exception $ e ) {
192190 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
193191 }
@@ -221,7 +219,7 @@ public function insertOne($namespace, array $data = [])
221219 * @return bool|string
222220 * @throws MongoDBException
223221 */
224- public function insertAll ($ namespace , array $ data )
222+ public function insertMany ($ namespace , array $ data )
225223 {
226224 if (count ($ data ) == count ($ data , 1 )) {
227225 throw new MongoDBException ('data is can only be a two-dimensional array ' );
@@ -231,7 +229,7 @@ public function insertAll($namespace, array $data)
231229 * @var $collection MongodbConnection
232230 */
233231 $ collection = $ this ->getConnection ();
234- return $ collection ->execInsertAll ($ namespace , $ data );
232+ return $ collection ->execInsertMany ($ namespace , $ data );
235233 } catch (MongoDBException $ e ) {
236234 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
237235 }
@@ -281,23 +279,108 @@ public function updateColumn($namespace, array $filter = [], array $newObj = [])
281279 }
282280 }
283281
282+ /**
283+ * 更新数据满足$filter的行的信息成$newObject(_id自动转对象)
284+ *
285+ * @param $namespace
286+ * @param array $filter
287+ * @param array $newObj
288+ * @return bool
289+ * @throws MongoDBException
290+ */
291+ public function updateRowId ($ namespace , array $ filter = [], array $ newObj = []): bool
292+ {
293+ try {
294+ /**
295+ * @var $collection MongodbConnection
296+ */
297+ $ collection = $ this ->getConnection ();
298+ return $ collection ->execUpdateRowId ($ namespace , $ filter , $ newObj );
299+ } catch (\Exception $ e ) {
300+ throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
301+ }
302+ }
303+
304+ /**
305+ * 只更新数据满足$filter的行的列信息中在$newObject中出现过的字段(_id自动转对象)
306+ *
307+ * @param $namespace
308+ * @param array $filter
309+ * @param array $newObj
310+ * @return bool
311+ * @throws MongoDBException
312+ */
313+ public function updateColumnId ($ namespace , array $ filter = [], array $ newObj = []): bool
314+ {
315+ try {
316+ /**
317+ * @var $collection MongodbConnection
318+ */
319+ $ collection = $ this ->getConnection ();
320+ return $ collection ->execUpdateColumnId ($ namespace , $ filter , $ newObj );
321+ } catch (\Exception $ e ) {
322+ throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
323+ }
324+ }
325+
326+ /**
327+ * 删除满足条件的数据,默认只删除匹配条件的第一条记录,如果要删除多条$limit=true
328+ *
329+ * @param string $namespace
330+ * @param array $filter
331+ * @return bool
332+ * @throws MongoDBException
333+ */
334+ public function deleteOne (string $ namespace , array $ filter = []): bool
335+ {
336+ try {
337+ /**
338+ * @var $collection MongodbConnection
339+ */
340+ $ collection = $ this ->getConnection ();
341+ return $ collection ->execDeleteOne ($ namespace , $ filter );
342+ } catch (\Exception $ e ) {
343+ throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
344+ }
345+ }
346+
284347 /**
285348 * 删除满足条件的数据,默认只删除匹配条件的第一条记录,如果要删除多条$limit=true
286349 *
287350 * @param string $namespace
288351 * @param array $filter
289- * @param bool $limit
290352 * @return bool
291353 * @throws MongoDBException
292354 */
293- public function delete (string $ namespace , array $ filter = [], bool $ limit = false ): bool
355+ public function deleteMany (string $ namespace , array $ filter = []): bool
356+ {
357+ try {
358+ /**
359+ * @var $collection MongodbConnection
360+ */
361+ $ collection = $ this ->getConnection ();
362+ return $ collection ->execDeleteMany ($ namespace , $ filter );
363+ } catch (\Exception $ e ) {
364+ throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
365+ }
366+ }
367+
368+ /**
369+ * 删除满足条件的数据,默认只删除匹配条件的第一条记录,如果要删除多条$limit=true(_id自动转对象)
370+ *
371+ * @param string $namespace
372+ * @param array $filter
373+ * @return bool
374+ * @throws MongoDBException
375+ */
376+ public function deleteOneId (string $ namespace , array $ filter = []): bool
294377 {
295378 try {
296379 /**
297380 * @var $collection MongodbConnection
298381 */
299382 $ collection = $ this ->getConnection ();
300- return $ collection ->execDelete ($ namespace , $ filter, $ limit );
383+ return $ collection ->execDeleteOneId ($ namespace , $ filter );
301384 } catch (\Exception $ e ) {
302385 throw new MongoDBException ($ e ->getFile () . $ e ->getLine () . $ e ->getMessage ());
303386 }
0 commit comments