MongoRecord extensions Active Record extensions for MongoDb
#1
Posted 23 September 2010 - 12:35 PM
http://www.yiiframew...on/mongorecord/
I use it at my personal project at http://rserve.me
The reasons to release this extensions is to share it with the community and get feedback from you all. May be you can also help me to test this component.
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#2
Posted 23 September 2010 - 01:28 PM
Great. I've started Mongo extension when 1.1 was just released but never finished it. Maybe you can find something useful in the source: http://code.google.c.../storages/mongo
#3
Posted 23 September 2010 - 09:59 PM
let me know if you guys cook up something so I can feature it in a podcast!
keep it up,
--iM
The maker rests. The wheel’s in motion.
-- Imre Madách
check out Yii Themes at http://yiithemes.mehesz.net
#4
Posted 23 September 2010 - 11:34 PM
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#5
Posted 29 September 2010 - 04:12 AM
Let me see if I can help.
In the docs you have this example:
$query=array('merchant_id'=>1,'');
ModelName::model()->findAll($query);I believe the example is incorrect as it should be:
$query=array('query'=>array('merchant_id'=>1));
ModelName::model()->findAll($query);Also will not work:
$query=array('_id=>'4c8377a88ead0ec468000000');
ModelName::model()->find($query);We have to set a MongoID object to do this query:
$mongo_id = new MongoID("4c8377a88ead0ec468000000");
$query=array('_id=>$mongo_id);
ModelName::model()->find($query);Keep up the good work.
#6
Posted 29 September 2010 - 07:17 PM
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#7
Posted 07 October 2010 - 01:37 PM
Have you seen "Morph" http://code.google.com/p/mongodb-morph
It's an activerecord mongodb implementation, that also supports relationships between collections.
It could be a nice addition to your code, isn't it?
Regards..
#8
Posted 08 October 2010 - 10:17 PM
ironwolf, on 07 October 2010 - 01:37 PM, said:
Have you seen "Morph" http://code.google.com/p/mongodb-morph
It's an activerecord mongodb implementation, that also supports relationships between collections.
It could be a nice addition to your code, isn't it?
Regards..
Thanks, i just saw the library and it's bring some of great features to implement on this extension. Thanks for advice, will try to implement some of it's features at future development.
Thanks,
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#9
Posted 22 October 2010 - 04:03 AM
Is there any chance it will be compatible with CDataProvider soon (for e.g. to be used in ListWidget)
#10
Posted 05 November 2010 - 09:38 PM
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#12
Posted 09 November 2010 - 04:54 AM
https://github.com/crodas/ActiveMongo
so im not sure if you could use some of the info for mongoRecord or if that will even work for yii. anyhow i have a question. In using mongo record, i see many thing are listed to work. which is cool. But is it possible to get a list of what does NOT work. Above litervollmilch mentioned it couldnt be used with ListWidget. So I am wondering what else cannot be used with it. Are there any other widgets that cannot be used with it? This will help in figuring out how to convert the blog tutorial into using mongoDB (which I hope to post when im done converting it).
either way, thanks for the extension.
#13
Posted 23 November 2010 - 04:59 AM
When read data,it works fine:
$query = array('mykey'=> 'abcdefg');
$result = Transmission::model()->findAll($query);
print_r($result);
returns:
Array
(
[0] => Transmission Object
(
[_document:protected] => Array
(
[mykey] => abcdefg
[myvalue] => testvalue
[_id] => MongoId Object
(
)
)
[_id:private] =>
[_new:private] =>
[_flatAttributes:private] =>
[_errors:private] => Array
(
)
[_validators:private] =>
[_scenario:private] =>
[_e:private] =>
[_m:private] =>
)
[1] => Transmission Object
(
[_document:protected] => Array
(
[tmykey=> abcdefg
[myvalue] => testvalue
[_id] => MongoId Object
(
)
)
[_id:private] =>
[_new:private] =>
[_flatAttributes:private] =>
[_errors:private] => Array
(
)
[_validators:private] =>
[_scenario:private] =>
[_e:private] =>
[_m:private] =>
)
)
------------------------------------------
But when I try to delete the document,it go wrong:
$key ='abcdefg';
$query = array('mykey'=> 'abcdefg');
$model = Transmission::model()->findAll($query);
$model->delete();
Php told me "Call to a member function delete() on a non-object"?
How to delete documents or duplicated documents?
#14
Posted 23 November 2010 - 05:03 AM
#15
Posted 23 November 2010 - 08:50 PM
$items=YourModel::model()->findAll();
foreach($items as $item){
$item->delete();
}Unfortunately my extension haven't support yet for deleteAll() method. I forgot this important feature. Will be plan to implement it soon. Thanks for remind me.
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------
#17
Posted 24 November 2010 - 03:30 AM
I'm using Yii 1.1.4,when I use foreach to delete each of the queried items return by findAll(),another exception occured.
CException Description MyModel does not have a method named "deleteByPk". Source File /data/yii/framework/base/CComponent.php(266)
What shall I do...
#18
Posted 03 January 2011 - 01:32 AM
amazergling, on 24 November 2010 - 03:30 AM, said:
I'm using Yii 1.1.4,when I use foreach to delete each of the queried items return by findAll(),another exception occured.
CException Description MyModel does not have a method named "deleteByPk". Source File /data/yii/framework/base/CComponent.php(266)
What shall I do...
Not all method in ActiveRecord supported by this extension. Will try to cover it all. Please go to github repo for this extension and create new ticket. Thanks.
http://www.thinkrooms.com - Application Development Studio
http://rserve.me - Realtime Reservation Platform
----------------------------------------------------------------------------------

Help













