1

I am testing out PHP (Codeigniter) and Mongo (library by alexbilbie). I a new to MongoDB so I got a few starting questions.

  1. Is the library by Alex ready for production use? Can I use all mongodb features?

  2. Is Alex library the best for Mongodb to Codeigniter use?

  3. Do I have to use chained queries like this?

    $this->mongo_db->where(array('firstname' => 'Michael'))->get('users');

I want each "part" on a separate row like this:

$this->mongo_db->select('*');
$this->mongo_db->from('users');
$this->mongo_db->where(array('firstname' => 'Michael'));

$query = $this->db->get();

Thank you!

2
  • 1
    Try contacting Alex on Twitter, @alexbilbie. Commented Sep 13, 2011 at 11:33
  • Yeah, but not for question 1 and 2. Commented Sep 13, 2011 at 15:14

1 Answer 1

2

$this->mongo_db->where(array('firstname' => 'Michael'))->get('users');

This is very similar to how the driver operates which is likely why it was chosen. The syntax you're looking for is basically an SQL variant. While possible, this is not generally how it's done with MongoDB as MongoDB doesn't use SQL.

Is the library by Alex ready for production use? Can I use all mongodb features?

In terms of production-readiness, you'll have to run your own sanity checks. MongoDB is backed by a well-funded company (10gen) and the PHP driver is maintained by them. So you should be good there.

For the library, all of the commits have been performed by one maintainer. It's probably in production being used by him, but the code has zero unit tests which is not a great sign.

The wiki would seem to imply that not all features are covered. He even has "maybe" written beside things like "add user".

Is Alex library the best for Mongodb to Codeigniter use?

This is very subjective, how many MongoDB+Codeigniter libraries have you found?

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your comments! The bitbucket version that you are looking at is out of date is seems. This is the new home: github.com/alexbilbie/codeigniter-mongodb-library. I found one more but actually I am just wondering if I am better of with the native PHP driver?
I also started to learn MongoDB recently, and I preferred to stick with the native php driver at first. I now developed a small library to integrate MongoDB with CodeIgniter, but unlike AlexBilbie, mine focuses on easing the connection to authenticated mongo databases using a config file while letting you use the native php driver. You can check it out here hg.longo.me/mongol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.