2017 © Pedro Peláez
 

library phpmongoquery

Mongo queries in PHP

image

akkroo/phpmongoquery

Mongo queries in PHP

  • Tuesday, May 22, 2018
  • by nrbrook
  • Repository
  • 12 Watchers
  • 0 Stars
  • 218 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 54 % Grown

The README.md

PHPMongoQuery

Mongo queries in PHP, (*1)

PHPMongoQuery implements MongoDB queries in PHP, allowing developers to query a 'document' (an array containing data) against a Mongo query object, returning a boolean value for pass or fail. Additionally a set of documents can be queried to filter them, as queries are used in MongoDB., (*2)

This code is used at Akkroo to allow the construction of advanced form logic queries in the form field definition., (*3)

Usage

<?php

use Akkroo\PHPMongoQuery;

$query = array('a' => 'foo', 'b' => array('$ne' => 'bar'));
$document = array(
            'id' => 1,
            'a' => 'foo',
            'b' => 'barr'
        );
var_dump(PHPMongoQuery::executeQuery($query, $document));

This will output, (*4)

bool(true)

Methods

find($query, $documents, $options)

Perform a query on a set of documents to filter out only those which pass the query, (*5)

executeQuery($query, $documents, $options)

Execute a query on a single document, returning a boolean value for pass or fail, (*6)

appendFieldSpecifier($query, $append)

Append a field specifier to any field queries. For example, your query may have been written as follows:, (*7)

$query = array('a' => 'foo');

However, the actual document structure is, (*8)

$document = array('a' => array('value' => 'foo'), 'b' => array('value' => 'bar'));

So you need to append the 'value' specifier to the query field specifiers for the query to work. For example:, (*9)

$newQuery = PHPMongoQuery::appendFieldSpecifier($query, 'value');
// $newQuery is array('a.value' => 'foo');

getDependentFields($query)

Parse a query to find all the fields it depends on. This is useful for listening to when those values change, so the query is only repeated when the result could have changed. For example:, (*10)

$query = array('a' => 'foo');
$dependentFields = PHPMongoQuery::getDependentFields($query);
// $dependentFields is array('a');

The Versions

22/05 2018

dev-fix/find-method

dev-fix/find-method https://github.com/Akkroo/PHPMongoQuery

Mongo queries in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb php document queries

15/05 2018

dev-master

9999999-dev https://github.com/Akkroo/PHPMongoQuery

Mongo queries in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb php document queries

15/05 2018

v1.0.1

1.0.1.0 https://github.com/Akkroo/PHPMongoQuery

Mongo queries in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb php document queries

30/07 2013

dev-develop

dev-develop https://github.com/Akkroo/PHPMongoQuery

Mongo queries in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb php document queries

29/07 2013

v1.0.0

1.0.0.0 https://github.com/Akkroo/PHPMongoQuery

Mongo queries in PHP

  Sources   Download

MIT

The Requires

 

mongodb php document queries