Mongodloid: more or less handy PHP library for MongoDB

11 views
Skip to first unread message

va1en0k

unread,
Dec 12, 2009, 12:48:18 AM12/12/09
to mongodb-user
I've been writing a library for not a very long time and still
satisfied by results.
It's just a bit higher level of abstraction from Mongo php library.

Please, if you have some free time, test it and tell me, what do you
think and what will be cool to add/improve. Or even add/improve it by
yourself :-)

I hope no one is against it to be here in groups?

http://code.google.com/p/mongodloid/ here is a link.
http://code.google.com/p/mongodloid/downloads/list - downloads
http://code.google.com/p/mongodloid/wiki/Using - not much
documentation

Some parts:

== Atomic operations ==

$entity->inc('a')->inc('a', 3) // chaining!
->set('b', 'hi')
->push('c', 1221)
->pushAll('d', array(8, 5, 9, 6))
->pop('e')
->pop('f', Mongodloid_Entity::POPFIRST)
->shift('f')
->pull('g', 2)
->pullAll('h', array(1, 3));

== Queries ==

$query = $collection->query('a', 12); // a == 12
$query = $collection->query();


$query->equals('a', 13)->greaterEq('b', 8)->mod('c', 3, 4);

// or even

$query->query('a == 13 AND b >= 8 && c % 3 == 4'); // wow!

foreach($query as $entity) {}

== Getters and setters ==

$entity = new Mongodloid_Entity(array(
'hi' => 'there',
'i' => array(
'am' => array(
'an' => array('ar', 'ray')
)
)
);
$entity->get('hi'); // there
$entity->get('i.am.an[1]'); // ray
$entity->set('i.am.an[2]', ':-)');


"Roadmap":

Triggers: http://code.google.com/p/mongodloid/issues/detail?id=12
Guessing indexes to ensure: http://code.google.com/p/mongodloid/issues/detail?id=7
http://code.google.com/p/mongodloid/issues/list?q=type:feature
Anything else?

John Wyles

unread,
Dec 13, 2009, 9:00:50 PM12/13/09
to mongod...@googlegroups.com
This is a great start and seems to be fairly through compared with the
other wrappers I have seen. Perhaps some of these could be worked
into the official PHP library?
> --
>
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>
>

Valentin Golev

unread,
Dec 13, 2009, 11:36:44 PM12/13/09
to mongod...@googlegroups.com
Hm, I think it would be great.

I don't really experienced in writing PHP extensions, but then I achieve some point in Mongodloid and have some feedback I'll try to hack Mongo extension itself.
--
- Valentin Golev

Kristina Chodorow

unread,
Dec 14, 2009, 5:13:25 PM12/14/09
to mongod...@googlegroups.com
Looks great, thanks for sharing it! 

I've added a short description and links at http://www.mongodb.org/display/DOCS/PHP+Language+Center#PHPLanguageCenter-Mongodloid.  (Let me know if you'd like me to change the description or anything.)

Valentin Golev

unread,
Dec 14, 2009, 9:37:55 PM12/14/09
to mongod...@googlegroups.com
Thanks!

Colin M

unread,
Dec 15, 2009, 11:07:31 AM12/15/09
to mongodb-user
Nice work!

Small suggestion: pop('f', Mongodloid_Entity::POPFIRST) could instead
be unshift('f') which is consistent with PHP array constructs.

I have my own wrapper under development which shares some similarity
with yours and more with Wouterr's Kohana extension (Mango) but much
simpler. I think the official PHP library is already good and any
further functionality is subjective so should be kept to the domain of
a wrapper like this. I'm sure more wrappers will surface in the
future, each with it's own set of strengths.

Colin

On Dec 12, 12:48 am, va1en0k <v.go...@gmail.com> wrote:
> I've been writing a library for not a very long time and still
> satisfied by results.
> It's just a bit higher level of abstraction from Mongo php library.
>
> Please, if you have some free time, test it and tell me, what do you
> think and what will be cool to add/improve. Or even add/improve it by
> yourself :-)
>
> I hope no one is against it to be here in groups?
>
> http://code.google.com/p/mongodloid/here is a link.http://code.google.com/p/mongodloid/downloads/list- downloadshttp://code.google.com/p/mongodloid/wiki/Using- not much

Valentin Golev

unread,
Dec 15, 2009, 11:11:31 AM12/15/09
to mongod...@googlegroups.com
pop first is shift() in PHP :)

And yes, shift() is alias for pop('f', Mongodloid_Entity::POPFIRST) .

> Anything else?

--

You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.





--
- Valentin Golev

Colin M

unread,
Dec 15, 2009, 12:07:30 PM12/15/09
to mongodb-user
doh.. ;)
> >http://code.google.com/p/mongodloid/issues/detail?id=7http://code.goo...
> > > Anything else?
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google groups.com>
> > .
Reply all
Reply to author
Forward
0 new messages