How to query by datetime in Doctrine MongoDB ODM?

Why it was necessary to use MongoDB query syntax with  "array()"  in PHP driver extension for MongoDB?

  • In at least Ruby and Python implementation of MongoDB driver you use nearly identical syntax for commands that are used in Mongo shell which are compact and natural. Why in PHP driver everything is polluted with array() ?

  • Answer:

    A object in javascript is effectively a hashtable. PHP does not support a true hashtable or dictionary. Instead, PHP arrays actually serve as ordered dictionaries with some really funky behaviour from the various sort methods. So basically, the PHP equivalent of a JSON object is really a bunch of arrays using the "dictionary" syntax. And that's the answer to your question. The closest thing PHP has to JSON is the crazy array syntax.

Gaëtan Voyer-Perrault at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.