Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: c79ad79cb5
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (24 sloc) 0.837 kB
<?php
//Initialise Morph_Storage passing in the appropriate database
$mongo = new Mongo();
Morph_Storage::init($mongo->selectDb('myDB'));
$query = new Morph_Query();
$query->property('createdDate')
->greaterThan(MongoDate(time() - 604800)) //last week
->lessThan(new MondoDate(time())) //today
->property('cost')
->greaterThanOrEqualTo(12.99)
->sort(Morph_Enum::DIRECTION_ASC)
->property('publisher')
->in(array('publisherA', 'publisherB', 'publisherC'));
/**
* This query is roughly equivalent to the sql:
* SELECT * FROM `ABook` WHERE
* `createdDate` > DATE_SUB(now(), INTERVAL 1 WEEK)
* AND `createdDate` < now()
* AND `cost` >= 12.99
* AND `publisher` in ('publisherA', 'publisherB', 'publisherC')
* ORDER BY `cost`;
*/
$book = new A_Book();
$books = $book->findByQuery($query);
Jump to Line
Something went wrong with that request. Please try again.