purekid / mongodm

MongoDB ORM that includes support for references,embed and multilevel inheritance.
MIT License
200 stars 47 forks source link

slow to update #88

Closed zhongjixiuxing closed 7 years ago

zhongjixiuxing commented 9 years ago

In my Mongodb is exist App and User collection, is 1:many relationship. now, App has 1000 Users. my register code : '$app->users->add($user)'. is very slow! when there are more and more registered users, the system is more and more slow. so i viewed "Purekid\Mongodm\Model" source code, and i test ‘one’ method, i find when my call ‘$app->users->add($user)’, in "Purekid\Mongodm\Model::one" method will call "self::connection()->findOne(static::$collection, $criteria, self::mapFields($fields))" to load all user document in memory. how to solve this...

English is not my native language, may I write some grammar mistakes, please understand

purekid commented 9 years ago

加我 Q 1108960

2015-07-07 11:09 GMT+08:00 zhongjixiuxing notifications@github.com:

In my Mongodb is exist App and User collection, is 1:many relationship. now, App has 1000 Users. my register code : '$app->users->add($user)'. is very slow! when there are more and more registered users, the system is more and more slow. so i viewed "Purekid\Mongodm\Model" source code, and i test ‘one’ method, i find when my call ‘$app->users->add($user)’, in "Purekid\Mongodm\Model::one" method will call "self::connection()->findOne(static::$collection, $criteria, self::mapFields($fields))" to load all user document in memory. how to solve this...

English is not my native language, may I write some grammar mistakes, please understand

— Reply to this email directly or view it on GitHub https://github.com/purekid/mongodm/issues/88.