Neil Charlton
unread,Sep 2, 2011, 9:50:31 PM9/2/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to YiiMongoDbSuite
I'm successfully using version 1.3 to save to my MongoDb, so I know
its not a connectivity or other similar issue.
For some reason there seems to be a problem with querying
From the shell (version 1.8.2). If I use
$ db.products.find();
{ "_id" : ObjectId("4e60e0ccc0da53707c000000"), "display_title" :
"test", "price" : "100" }
{ "_id" : ObjectId("4e617cebc0da538f72000000"), "display_title" :
"test 2", "price" : "50" }
{ "_id" : ObjectId("4e617d2cc0da53b279000000"), "display_title" :
"test 3", "price" : "120" }
I know that I have 3 documents in this collection.
Using YiiMongoDbSuite from my controller I use this
$model = Product::model()->findAll();
print_r($model);
and I get
Array
(
[0] => Product Object
(
[display_title] =>
[price] =>
[_new:EMongoDocument:private] =>
[_criteria:EMongoDocument:private] =>
[_fsyncFlag:EMongoDocument:private] =>
[_safeFlag:EMongoDocument:private] =>
[useCursor:protected] =>
[ensureIndexes:protected] => 1
[_id] =>
[_embedded:protected] =>
[_owner:protected] =>
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[1] => Product Object
(
[display_title] =>
[price] =>
[_new:EMongoDocument:private] =>
[_criteria:EMongoDocument:private] =>
[_fsyncFlag:EMongoDocument:private] =>
[_safeFlag:EMongoDocument:private] =>
[useCursor:protected] =>
[ensureIndexes:protected] => 1
[_id] =>
[_embedded:protected] =>
[_owner:protected] =>
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[2] => Product Object
(
[display_title] =>
[price] =>
[_new:EMongoDocument:private] =>
[_criteria:EMongoDocument:private] =>
[_fsyncFlag:EMongoDocument:private] =>
[_safeFlag:EMongoDocument:private] =>
[useCursor:protected] =>
[ensureIndexes:protected] => 1
[_id] =>
[_embedded:protected] =>
[_owner:protected] =>
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
So it is returning the correct number of documents (3) but there is no
data in there. Does anyone know how to fix this?