Debugging queries

58 views
Skip to first unread message

new_moo

unread,
Jun 18, 2012, 4:20:48 AM6/18/12
to YiiMongoDbSuite
Hi, everyone. Is there any way to get what queries generated by
YIIMDS ?

and second my question how to manage (control) data types when assign
values ?
what I mean ? as you know for MongoDB there is a difference between
string and numbers and if i'm using criteria object can I somehow set
particular type of comparison ? or I should use type convertation by
my self ?

when I'm using like that:

$criteria->creation_date('<=', $to_date === null ? time() : $to_date);

how I can make sure that YiiMDS will compare with integer value of
creation_date filed in DB ?

it is too big difference
db.collection.find({creation_date : {$lte: 1340006960}});
or
db.collection.find({creation_date : {$lte: "1340006960"}});

this is why it would be good to have some debug data about query
creation.

Thanks.

Attila Nagy

unread,
Jun 18, 2012, 10:28:35 AM6/18/12
to yiimong...@googlegroups.com
Hi!

For your first question: you can get the query object by dumping the
return value of the getConditions() method:

var_dump(json_encode($criteria->getConditions()));

You second: you should make shure, that you always submit the correct
type to the criteria object, eg:


$criteria->creation_date('<=', $to_date === null ? time() : (int)$to_date);
--
Nagy Attila Gabor

new_moo

unread,
Jun 20, 2012, 3:51:21 PM6/20/12
to yiimong...@googlegroups.com
Thank you, very much.

понедельник, 18 июня 2012 г., 17:28:35 UTC+3 пользователь mrbig написал:
Hi!

For your first question: you can get the query object by dumping the
return value of the getConditions() method:

var_dump(json_encode($criteria->getConditions()));

You second: you should make shure, that you always submit the correct
type to the criteria object, eg:


$criteria->creation_date('<=', $to_date === null ? time() : (int)$to_date);


--
Nagy Attila Gabor
Reply all
Reply to author
Forward
0 new messages