Browse Source

[ubiquity] fix update with mongo (#5978)

* Update DbMongo.php

* Update README.md

* Update README.md
J-C HERON 5 years ago
parent
commit
b88cfcbfe2

+ 63 - 29
frameworks/PHP/ubiquity/README.md

@@ -1,14 +1,43 @@
 # Ubiquity Benchmarking Test
 # Ubiquity Benchmarking Test
-![img](https://github.com/phpMv/ubiquity/blob/master/Banner/banner.png?raw=true)
+![img](https://github.com/phpMv/ubiquity/blob/master/Banner/banner-duck.png?raw=true)
 
 
 Ubiquity is a full-stack php framework, These tests involve:
 Ubiquity is a full-stack php framework, These tests involve:
 - the ORM part (Full)
 - the ORM part (Full)
 - the JSON serialization (native php)
 - the JSON serialization (native php)
 
 
-Tests are available with NginX server, Swoole and Workerman platforms.
+Tests are available with NginX server, Swoole Roadrunner and Workerman platforms.
 
 
 ## Test Type Implementation Source Code
 ## Test Type Implementation Source Code
 The tests are separated into controllers:
 The tests are separated into controllers:
+
+### Ubiquity + PDO Mysql
+- `Json` for JSON response
+  * [JSON](app/controllers/Json.php)
+- `Db` for database access with ORM (PDO Mysql)
+  * [DB](app/controllers/Db.php)
+  * [QUERY](app/controllers/Db.php)
+  * [CACHED QUERY (not implemented)]()
+  * [UPDATE](app/controllers/Db.php) Utilizes transactions
+- `Fortunes` for using the internal template engine
+  * [FORTUNES](app/controllers/Fortunes.php)
+- `Plaintext` for plaintext response
+  * [PLAINTEXT](app/controllers/Plaintext.php)
+
+### Ubiquity with async platforms (Swoole, Workerman or Roadrunner) + Pgsql
+- `Db_` for database access with ORM (PDO Pgsql)
+  * [DB](app/controllers/Db_.php)
+  * [QUERY](app/controllers/Db_.php)
+  * [CACHED QUERY (only with Workerman)](app/controllers/Cache.php)
+  * [UPDATE](app/controllers/Db_.php)
+- `Fortunes_` for using the internal template engine
+  * [FORTUNES](app/controllers/Fortunes_.php)
+
+### Ubiquity with async platforms (Swoole, Workerman or Roadrunner)
+- `Json_` for JSON response
+  * [JSON](app/controllers/Json_.php)
+- `Plaintext_` for plaintext response
+  * [PLAINTEXT](app/controllers/Plaintext_.php)
+
 ### Ubiquity + PDO Mysql
 ### Ubiquity + PDO Mysql
 - `Json` for JSON response
 - `Json` for JSON response
   * [JSON](app/controllers/Json.php)
   * [JSON](app/controllers/Json.php)
@@ -21,65 +50,70 @@ The tests are separated into controllers:
   * [FORTUNES](app/controllers/Fortunes.php)
   * [FORTUNES](app/controllers/Fortunes.php)
 - `Plaintext` for plaintext response
 - `Plaintext` for plaintext response
   * [PLAINTEXT](app/controllers/Plaintext.php)
   * [PLAINTEXT](app/controllers/Plaintext.php)
-### Ubiquity Swoole + Mysql
-- `SwooleDbMy` for database access with PDO Mysql driver (update test only)
-  * [SwooleDbAsync](app/controllers/SwooleDbAsync.php)
-- `SwooleDbAsync` for database access with Swoole coroutine Mysql driver
-  * [SwooleDbAsync](app/controllers/SwooleDbAsync.php)
-- `SwooleFortunesAsync` used with Swoole coroutine Mysql driver
-  * [SwooleFortunes](app/controllers/SwooleFortunes.php)
-### Ubiquity Swoole + PostgreSQL
-- `SwooleDb` for database access with PDO pgsql driver
-  * [SwooleDb](app/controllers/SwooleDb.php)
-- `SwooleFortunes` used with PDO pgsql driver
-  * [SwooleFortunes](app/controllers/SwooleFortunes.php)
-### Ubiquity Workerman + PDO pgsql
-- `Workerman` with PDO pgsql driver
-  * [WorkerDb](app/controllers/WorkerDb.php)
-- `WorkerFortunes` used with Workerman
-  * [WorkerFortunes](app/controllers/WorkerFortunes.php)
+
+### Ubiquity Workerman + MongoDb
+- `DbMongo` for database access
+  * [DB](app/controllers/DbMongo.php)
+  * [QUERY](app/controllers/DbMongo.php)
+  * [UPDATE](app/controllers/DbMongo.php)
+- `FortunesMongo` for using the internal template engine
+  * [FORTUNES](app/controllers/FortunesMongo.php)
+
 
 
 ## Important Libraries
 ## Important Libraries
 The tests were run with:
 The tests were run with:
 * [Ubiquity 2.3.*](https://ubiquity.kobject.net/)
 * [Ubiquity 2.3.*](https://ubiquity.kobject.net/)
-* [PHP Version 7.4.*](http://www.php.net/) with FPM and APC
+* [PHP Version 7.4.*](http://www.php.net/) with FPM
 * [nginx 1.14](http://nginx.org/)
 * [nginx 1.14](http://nginx.org/)
 * [Swoole](https://www.swoole.com/), [Ubiquity-swoole](https://github.com/phpMv/ubiquity-swoole)
 * [Swoole](https://www.swoole.com/), [Ubiquity-swoole](https://github.com/phpMv/ubiquity-swoole)
 * [Workerman](https://github.com/walkor/Workerman), [Ubiquity-workerman](https://github.com/phpMv/ubiquity-workerman)
 * [Workerman](https://github.com/walkor/Workerman), [Ubiquity-workerman](https://github.com/phpMv/ubiquity-workerman)
+* [Roadrunner](https://github.com/spiral/roadrunner), [Roadrunner-ubiquity](https://github.com/Lapinskas/roadrunner-ubiquity)
 * [MySQL 8.0](https://dev.mysql.com/)
 * [MySQL 8.0](https://dev.mysql.com/)
+* [MongoDb 4.2](https://www.mongodb.com/)
 
 
 
 
 ## Test URLs
 ## Test URLs
 ### JSON
 ### JSON
 
 
-http://localhost:8080/Json
+- http://localhost:8080/Json
+- http://localhost:8080/Json_
 
 
 ### PLAINTEXT
 ### PLAINTEXT
 
 
-http://localhost:8080/Plaintext
+- http://localhost:8080/Plaintext
+- http://localhost:8080/Plaintext_
 
 
 ### DB
 ### DB
 
 
-http://localhost:8080/Db
+- http://localhost:8080/Db
+- http://localhost:8080/Db_
+- http://localhost:8080/DbMy
+- http://localhost:8080/DbMongo/
+
 
 
 ### QUERY
 ### QUERY
 
 
 - http://localhost:8080/Db/query/
 - http://localhost:8080/Db/query/
-- http://localhost:8080/SwooleDb/query/
-- http://localhost:8080/WorkerDb/query/
+- http://localhost:8080/Db_/query/
+- http://localhost:8080/DbMy/query/
+- http://localhost:8080/DbMongo/query/
+
 
 
 ### CACHED QUERY
 ### CACHED QUERY
 
 
+- http://localhost:8080/Cache/cachedQuery/
 
 
 
 
 ### UPDATE
 ### UPDATE
 
 
 - http://localhost:8080/Db/update/
 - http://localhost:8080/Db/update/
-- http://localhost:8080/SwooleDb/update/
-- http://localhost:8080/WorkerDb/update/
+- http://localhost:8080/Db_/update/
+- http://localhost:8080/DbMy/update/
+- http://localhost:8080/DbMongo/update/
+
 
 
 ### FORTUNES
 ### FORTUNES
 
 
 - http://localhost:8080/Fortunes
 - http://localhost:8080/Fortunes
-- http://localhost:8080/SwooleFortunes
-- http://localhost:8080/WorkerFortunes
+- http://localhost:8080/Fortunes_
+- http://localhost:8080/FortunesMongo

+ 1 - 1
frameworks/PHP/ubiquity/app/controllers/DbMongo.php

@@ -24,7 +24,7 @@ class DbMongo extends Db_ {
 			]);
 			]);
 			do {
 			do {
 				$nRn = \mt_rand(1, 10000);
 				$nRn = \mt_rand(1, 10000);
-			} while ($world->randomNumber === $nRn);
+			} while ($world->randomNumber == $nRn);
 			$world->randomNumber = $nRn;
 			$world->randomNumber = $nRn;
 			DAONosql::toUpdate($world);
 			DAONosql::toUpdate($world);
 			$worlds[] = $world->_rest;
 			$worlds[] = $world->_rest;