Answer the question
In order to leave comments, you need to log in
Working from PHP with MongoDB 3.0 could be easier?
In previous versions of the php driver, it was possible to work with mongo (Also previous versions) easier and more convenient.
Now we have to do a lot of additional actions and write additional classes.
Among the new driver classes, is there one that simplifies everything?
For example,
/*Let's connect to the database*/
NeizvestniyClass("db.products.insert( { item: "card", qty: 15 } )")
Answer the question
In order to leave comments, you need to log in
MongoDB::execute won't work with MongoDB 3.0+ (as they deprecated eval)
All you need to do is write functions in PHP format.
You can even pass the data to JSON and pull it out for PHP /json_decode/.
$data = json_decode( '{ "item": "card", "qty": 15 }' ); // $_POST['product']
$mongoDB->products->insert( $data );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question