承接 akkroo/phpmongoquery 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akkroo/phpmongoquery

Composer 安装命令:

composer require akkroo/phpmongoquery

包简介

Mongo queries in PHP

README 文档

README

Mongo queries in PHP

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.

This code is used at Akkroo to allow the construction of advanced form logic queries in the form field definition.

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

bool(true)

Methods

find($query, $documents, $options)

Perform a query on a set of documents to filter out only those which pass the query

executeQuery($query, $documents, $options)

Execute a query on a single document, returning a boolean value for pass or fail

appendFieldSpecifier($query, $append)

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

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

However, the actual document structure is

$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:

$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:

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

统计信息

  • 总下载量: 5.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 16
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-07-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固