Skip to content

Commit e258525

Browse files
committed
Stable Release 1.0.0
1 parent 02718b3 commit e258525

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
[![Total Downloads](https://poser.pugx.org/marcqualie/mongominify/d/total.png)](https://packagist.org/packages/marcqualie/mongominify)
55
[![Latest Stable Version](https://poser.pugx.org/marcqualie/mongominify/version.png)](https://packagist.org/packages/marcqualie/mongominify)
66

7-
A drop-in library which acts as a transparent filter to MongoDB documents and compresses/decompresses data on the fly.
8-
Entirely namespaced, PSR-0 compliant and works with both PHP 5.3 and 5.4.
7+
MongoMinify is a drop-in library which acts as a transparent filter to MongoDB documents and compresses/decompresses data on the fly.
8+
PSR-1 compliant and works with PHP 5.3+.
99

1010

1111
### Getting started
@@ -15,11 +15,11 @@ You should check out the [Getting Started](https://github.com/marcqualie/mongomi
1515

1616
### Quick Instalation
1717

18-
Put the following inside your composer.json
18+
The best way to install this library is via composer.
1919

2020
{
2121
"require": {
22-
"marcqualie/mongominify": "0.0.*"
22+
"marcqualie/mongominify": "~1.0"
2323
}
2424
}
2525

@@ -32,6 +32,12 @@ Myself and many other developers got around this by adding single letter key nam
3232
MongoMinify gets around this problem by transparently converting documents as they are transfered between the client and the database leaving readable code with compressed storage.
3333

3434

35+
## Requirements
36+
37+
- PHP 5.3+
38+
- MongoDB PHP Driver 1.3+
39+
40+
3541
## Feedback / Contributing
3642

37-
Any feedback, pull requests or documentation would be greatly apreciated.
43+
Feedback and pull requests on Github are always welcome.

lib/MongoMinify/Client.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class Client
1919
public function __construct($server = 'mongodb://localhost:27017', array $options = array())
2020
{
2121

22+
// Link timeouts
23+
Cursor::$timeout = \MongoCursor::$timeout;
24+
\MongoCursor::$timeout =& Cursor::$timeout;
25+
2226
// Parse MongoDB Path Info
2327
if (! empty($options['db'])) {
2428
$db_name = $options['db'];
@@ -39,7 +43,7 @@ public function __construct($server = 'mongodb://localhost:27017', array $option
3943
if ($db_name) {
4044
$this->selectDb($db_name);
4145
}
42-
46+
4347
}
4448

4549

lib/MongoMinify/Cursor.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,11 @@ public function timeout($ms)
117117

118118

119119
/**
120-
* Array helper for inline cursorts
120+
* Array helper for inline cursors
121121
*/
122-
public function as_array()
122+
public function asArray()
123123
{
124124
return iterator_to_array($this, false);
125125
}
126126

127127
}
128-
129-
// Bind native timeouts
130-
// TODO: Temporary fix, need a better place to put this code
131-
Cursor::$timeout = \MongoCursor::$timeout;
132-
\MongoCursor::$timeout =& Cursor::$timeout;

tests/MongoMinify/Tests/CursorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function testAsArrayHelper()
253253
)
254254
);
255255
$collection->batchInsert($documents);
256-
$array = $collection->find()->sort(array('_id' => -1))->as_array();
256+
$array = $collection->find()->sort(array('_id' => -1))->asArray();
257257
$this->assertTrue(is_array($array));
258258
$this->assertEquals($array, array(
259259
array('_id' => 3, 'role' => 'moderator'),

tests/MongoMinify/Tests/QueryTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function testElemMatch()
153153
array(
154154
'_id' => 1
155155
)
156-
)->as_array();
156+
)->asArray();
157157
$this->assertEquals($find, array(array('_id' => 1), array('_id' => 3)));
158158

159159
// Test operator matching
@@ -170,7 +170,7 @@ public function testElemMatch()
170170
array(
171171
'_id' => 1
172172
)
173-
)->as_array();
173+
)->asArray();
174174
$this->assertEquals($find, array(array('_id' => 1), array('_id' => 3), array('_id' => 4)));
175175

176176
}
@@ -213,7 +213,7 @@ public function testAndOr()
213213
array(
214214
'_id' => 1
215215
)
216-
)->as_array();
216+
)->asArray();
217217
$this->assertEquals($find, array(array('_id' => 2)));
218218
$find = $collection->find(
219219
array(
@@ -229,7 +229,7 @@ public function testAndOr()
229229
array(
230230
'_id' => 1
231231
)
232-
)->as_array();
232+
)->asArray();
233233
$this->assertEquals($find, array());
234234

235235
// Test $or
@@ -247,7 +247,7 @@ public function testAndOr()
247247
array(
248248
'_id' => 1
249249
)
250-
)->as_array();
250+
)->asArray();
251251
$this->assertEquals($find, array(array('_id' => 1), array('_id' => 2)));
252252
$find = $collection->find(
253253
array(
@@ -263,7 +263,7 @@ public function testAndOr()
263263
array(
264264
'_id' => 1
265265
)
266-
)->as_array();
266+
)->asArray();
267267
$this->assertEquals($find, array());
268268

269269
}

0 commit comments

Comments
 (0)