Zend框架:Zend_Nosql_Mong​​o组件建议

Proposed Component Name建议的组件名称 Zend_Nosql_Mongo Zend_Nosql_Mong​​o
Developer Notes开发人员说明 http://framework.zend.com/wiki/display/ZFDEV/Zend_Nosql_Mongo http://framework.zend.com/wiki/display/ZFDEV/Zend_Nosql_Mongo
Proposers提议者 Valentin Golev 瓦伦丁Golev
Zend Liaison Zend的联络 TBD待定
Revision修订 1.0 - 6 January 2010: Initial Draft. 1.0 - 2010年1月6日:初步草案。 (wiki revision: 9) (维基修订:9)

Table of Contents目录表

<style type="text/css"> <!-- div.rbtoc1262799713448 {margin-left:0px; padding:0px} div.rbtoc1262799713448 ul {list-style:none; margin-left:0px; padding-left:0px} div.rbtoc1262799713448 li {margin-left:0px; padding-left:0px} --> </style>

  • 1. 1。 Overview 概述
  • 2. 2。 References 参考文献
  • 3. 3。 Component Requirements, Constraints, and Acceptance Criteria 组件需求,约束和验收标准
  • 4. 4。 Dependencies on Other Framework Components 其他的框架组件上的依赖关系
  • 5. 5。 Theory of Operation 工作原理
  • 6. 6。 Milestones / Tasks 里程碑/任务
  • 7. 7。 Class Index 类指数
  • 8. 8。 Use Cases 用例
  • 9. 9。 Class Skeletons 类骨架

1. 1。 Overview概述

Zend_Nosql_Mongo is a namespace containing wrappers and adapters for PHP Mongo classes, intended to make them more handy, simple and compatible with other ZF classes, such as Zend_Paginator. Zend_Nosql_Mong​​o是一个命名空间包含PHP蒙戈类的包装和适配器,旨在使他们更方便,简单,并与其他的ZF类,如Zend_Paginator,兼容。

2. 2。 References参考文献

  • MongoDB official site MongoDB的官方网站
  • Mongodloid, a library developed by the author of the proposal Mongodloid库,由作者开发的建议

3. 3。 Component Requirements, Constraints, and Acceptance Criteria组件需求,约束和验收标准

  • This component will expose the entire MongoDB API此组件揭露整个MongoDB的API
  • This component will expose even the API not supported by PHP driver if it is exposed by Mongo DB commands此组件公开甚至PHP驱动程序不支持的API,如果它是由暴露蒙戈 DB命令
  • This component will provide class for a Mongo Object.此组件提供一个蒙戈对象类。
    • In a mongo object will be only string, int, bool, double, null, array (of any of these types, recursively), Mongo Object, date, MongoID, binary, regexp and JS Code fields.在蒙戈对象是唯一的字符串,整型,布尔,双,空,数组(这些类型的任何递归),蒙戈对象,日期,MongoID,二进制,REGEXP和JS代码领域。 See also Data Types in Mongo 数据类型也蒙戈
    • Fields will be able to be accessed as a member variables, like $object->subObject->subObjField for { subObject : { subObjField : 17 } }.字段能够作为一个成员变量的访问,如$对象>子对象subObjField {子对象:{subObjField 17}} 。
  • This component will provide objects for individual documents as well as document collections此组件提供单独的文件以及文档集合中的对象
    • Document objects will allow arbitrary fields Document对象允许任意字段
    • Document objects will provide accessors for document IDs Document对象提供的文档ID的访问器
    • Document objects will allow arbitrary fields Document对象允许任意字段
    • Document objects will be instances of a class which extends BSON Object Document对象扩展BSON对象的类的实例
    • Document objects will allow atomic operations like increment Document对象允许原子操作 ,像增量
    • Document Collections will be iterable所收集的文件被迭代的
    • Document Collections will be countable文档集合是可数
    • Document Collections will allow adding and removing documents所收集的文件允许添加和删除文件
    • Document Collections will allow retrieving documents by ID所收集的文件允许通过ID检索文件
    • Document Collections will allow prohibition of arbitrary fields所收集的文件允许禁止任意字段
    • Document Collections will allow strong client-side typing of fields, like 'int' or 'int|array(int)|null'所收集的文件允许强大的客户端键入的字段,如“INT”或“INT |阵列(INT)| NULL'
    • Document Collections will allow validators for fields所收集的文件允许字段校验器
  • This component will allow using GridFS for storing files此组件允许使用存储文件GridFS
    • This component will be able to be used with Zend MVC此组件能够使用与Zend MVC
  • This component will provide a special object for Query此组件提供一个特殊的对象进行查询
    • Query will be countable查询被计数
    • Query will be iterable (by returning Cursor for iteration)查询可迭代(迭代返回游标)
  • This component will provide a special object for Cursor, which is returned by executing Query此组件提供执行的查询返回的光标,这是一个特殊的对象
    • Cursor will be countable光标是可数
    • Cursor will be iterable光标被迭代的
  • This component will allow to set a specific class for documents in specific collections, as soon as it implements a special interface此组件允许设置一个特定的集合中的文档的特定的类,只要它实现了一个特殊的接口
    • Cursor and Collection will return instances of these specific classes instead of usual Document classes光标和征收返回这些具体的类的实例,而不是通常的文件类

4. 4。 Dependencies on Other Framework Components其他的框架组件上的依赖关系

  • Zend_Exception Zend_Exception异常
  • Zend_Validate Zend_Validate
  • Zend_Paginator Zend_Paginator
  • Zend_Date Zend_Date的
  • Zend_Controller (for using GridFS with MVC) Zend_Controller的(使用MVC的GridFS)

5. 5。 Theory of Operation工作原理

Users create a link to Database, providing connection and db information to the Zend_Nosql_Mongo_Db.用户可以创建一个到数据库的链接,提供连接和DB信息的Zend_Nosql_Mong​​o_Db。
Then they can get a link to a specific collection (which will be created, if not exists).然后,他们可以得到一个链接到一个特定的集合(,如果不存在将创建)。

Users can create a Zend_Nosql_Mongo_Object from any array, as soon as all its values (recursively) can be converted to Mongo types.用户可以从任何数组创建一个Zend_Nosql_Mong​​o_Object,只要其所有值(递归)可以转换为蒙戈类型。 They can save Zend_Nosql_Mongo_Object to any collection.他们可以节省Zend_Nosql_Mong​​o_Object任何集合。 Saving operation, as well as retrieving, returns an instance of Zend_Nosql_Mongo_Document, which has a specific _id and knows a name of its collection.节能运行,以及检索,返回的Zend_Nosql_Mong​​o_Document实例,其中有一个具体_id的,并且知道其收集的名称。

Users can query any collection.用户可以查询任何集合。 They can add more and more conditions to the query.他们可以添加越来越多的条件查询。 When they are done, they can transform the query to a cursor and iterate or array-access it.当他们完成后,他们可以改变一个游标查询和迭代或数组访问。

Users can set a specific class for a document of specific collection.用户可以设置一个特定类的一个特定集合的文件。 It must implement Zend_Nosql_Mongo_Document_Interface or, even better, inherit from Zend_Nosql_Mongo_Document.它必须实现Zend_Nosql_Mong​​o_Document_Interface,或者甚至更好,从Zend_Nosql_Mong​​o_Document继承。 In this case, all cursors from queries on this collection will return the specified class.在这种情况下,所有游​​标在此集合的查询将返回指定的类。

Users can make document schema more strict by providing validators, strong typing and disallowing arbitrary fields for any collection.用户可以通过提供校验,强类型,不允许任何集合的任意领域更加严格的文档架构。 Values of each typed field will be tested if it has one of specified types.每个类型的字段的值将被测试,如果有指定的类型之一。 If not, it will be converted to the first of the type in the list.如果不是,它会被转换为类型列表中的第一。 If the conversion fails and 'null' is not allowed for the field, the exception is thrown instead of saving a document.如果转换失败,'null'是不是允许的领域,抛出异常,而不是保存文档。

6. 6。 Milestones / Tasks里程碑/任务

  • Milestone 1: Initial proposal and prototype里程碑1:最初的建议和原型
  • Milestone 2: All unit tests里程碑2:所有的单元测试
  • Milestone 3: Working code, all unit tests passed里程碑3:工作的代码,所有的单元测试通过
  • Milestone 4: Documentation里程碑4:文件

7. 7。 Class Index类指数

  • Zend_Nosql_Mongo_Db Zend_Nosql_Mong​​o_Db
  • Zend_Nosql_Mongo_Collection Zend_Nosql_Mong​​o_Collection
  • Zend_Nosql_Mongo_Document Zend_Nosql_Mong​​o_Document
  • Zend_Nosql_Mongo_Document_Interface Zend_Nosql_Mong​​o_Document_Interface
  • Zend_Nosql_Mongo_Object Zend_Nosql_Mong​​o_Object
  • Zend_Nosql_Mongo_Object_Interface Zend_Nosql_Mong​​o_Object_Interface
  • Zend_Nosql_Mongo_Query Zend_Nosql_Mong​​o_Query
  • Zend_Nosql_Mongo_Cursor Zend_Nosql_Mong​​o_Cursor
  • Zend_Nosql_Mongo_Id Zend_Nosql_Mong​​o_Id
  • Zend_Nosql_Mongo_Date Zend_Nosql_Mong​​o_Date
  • Zend_Nosql_Mongo_Regexp Zend_Nosql_Mong​​o_Regexp
  • Zend_Nosql_Mongo_Code Zend_Nosql_Mong​​o_Code
  • Zend_Nosql_Mongo_Gridfs Zend_Nosql_Mong​​o_Gridfs
  • Zend_Nosql_Mongo_Gridfs_File Zend_Nosql_Mong​​o_Gridfs_File
  • Zend_Nosql_Mongo_Gridfs_Cursor Zend_Nosql_Mong​​o_Gridfs_Cursor
  • Zend_Nosql_Mongo_Gridfs_Mvc? Zend_Nosql_Mong​​o_Gridfs_Mvc?

8. 8。 Use Cases用例

?
$db = Zend_Nosql_Mongo_Db(null, 'testdb');
$coll = $db->getCollection('testcollection');
for ($i = 0; $i < 100; $i++) {
echo $coll->save(new Zend_Nosql_Mongo_Object(array('field' => $i))->getId(), " is another unique id\n";
}
$q = $coll->ensureIndex('field')->query()->lowerThan('field', 10);
foreach ($q as $item) echo $item->field, " must be lower than 10!\n";

9. 9。 Class Skeletons类骨架

?
class Zend_Nosql_Mongo_Db {
public function __construct($host = null, $dbname = null) {}
public function setOptions($options) {}
public function getCollection($collectionName) {}
}
class Zend_Nosql_Mongo_Collection
implements IteratorAggregate, Countable {
public function __construct($db = null, $name = null) {}
public function setOptions($options) {}
public function setDocumentClass() {}
public function ensureIndex($field, $direction) {}
public function save(Zend_Nosql_Mongo_Object_Interface $object) {}
public function query() {}
public function count() {}
public function getIterator() {}
public function setFieldTypes($field, $types) {}
public function setFieldsTypes($fieldstypes) {}
public function setFieldValidator($field, $validator) {}
}
class Zend_Nosql_Mongo_Document
extends Zend_Nosql_Mongo_Object
implements Zend_Nosql_Mongo_Document_Interface {
public function __construct($data, Zend_Nosql_Mongo_Collection $collection) {}
public function getId() {}
public function getCollection() {}
public function save() {}
public function isChanged() {}
public function commit() {}
/*
* and functions for atomic operations
* see http://www.mongodb.org/display/DOCS/Updating#Updating-ModifierOperations
* see http://code.google.com/p/mongodloid/
*/
}
interface Zend_Nosql_Mongo_Document_Interface
extends Zend_Nosql_Mongo_Object_Interface {
public function __construct($data, Zend_Nosql_Mongo_Collection $collection) {}
public function getId() {}
public function getCollection() {}
public function save() {}
public function isChanged() {}
public function commit() {}
//and functions for atomic operations
}
class Zend_Nosql_Mongo_Object {
public function __construct($data) {}
function __get() {}
function __set() {}
}
interface Zend_Nosql_Mongo_Object_Interface {
public function __construct($data) {}
}
class Zend_Nosql_Mongo_Query
implements IteratorAggregate, Countable {
public function __construct(Zend_Nosql_Mongo_Collection $collection) {}
public function getCursor() {}
public function count() {}
public function getIterator() {}
/*
* and functions for all conditions
* see http://www.mongodb.org/display/DOCS/Advanced+Queries
* see http://code.google.com/p/mongodloid/
*/
}
class Zend_Nosql_Mongo_Cursor
implements Iterator, Countable {
public function __construct(Zend_Nosql_Mongo_Collection $collection, $query) {}
public function current() {}
public function key() {}
public function next() {}
public function rewind() {}
public function valid() {}
public function count() {}
}

Jan 21, 2010 2010年01月21日,

Magnier Magnier

Hi,嗨,

some news of this very interesting proposal ?一些这个非常有趣的建议的消息?

  • Permalink 永久

Jan 21, 2010 2010年01月21日,

Kazusuke Sasezaki Kazusuke Sasezaki

Nosql..? NoSQL的..? I think that "Zend_Nosql" is not good namespace.我认为,“Zend_Nosql”没有良好的命名空间。

Had not namespace(Zend_DocDb) been considered for document-oriented database?没有命名空间(Zend_DocDb)被认为是面向文档的数据库?
@see CouchDb's proposal @看到CouchDB的建议

  • Permalink 永久

Feb 23, 2010 2010年02月23日,

Coen Hyde 科恩海德

By the way my prototype mongodb adapter is coming along well.顺便说一下,我的原型mongodb的适配器是相处得很好。 It's taken a little longer than i expected它比我预想的长一点 . 。 However it has become a completely different beast to what Valentin layed out above.然而,它已成为什么瓦伦丁上面奠定了一个完全不同的野兽。 Shortly i will have it available to discuss.不久,我会讨论。 Currently it does not support advanced queries, however i know Valentin is the author of mongodloid and figured i'd leave that to his area of expertise.目前它不支持高级的查询,但是我知道瓦伦丁mongodloid作者和我离开,他的专长领域。

  • Permalink 永久

Feb 23, 2010 2010年02月23日,

John Wyles 约翰Wyles

Can both of you please stay in touch with me as I am keenly interested in opening up the source for my own proprietary efforts.都请你留在我身边,因为我深知在为我自己的专有努力开辟源有兴趣的联系。 Thanks!谢谢!

  • Permalink 永久

Mar 03, 2010 2010年03月03,

Hector Virgen 海克特圣女

Anything we can do to keep this going?任何我们可以做,以保持这个部落的? Is there a github repo or something we can download / contribute to?是否有一个GitHub的回购或东西,我们可以下载/贡献?

  • Permalink 永久

Mar 12, 2010 2010年03月12日,

Hector Virgen 海克特圣女

Sounds great, looking forward to testing it.听起来不错,期待测试。 Have you considered adding support for master/slave configurations?你有没有考虑加入支持主/从配置吗?

http://www.snailinaturtleneck.com/blog/2010/02/01/mongo-mailbag-masterslave-configuration/ http://www.snailinaturtleneck.com/blog/2010/02/01/mongo-mailbag-masterslave-configuration/

  • Permalink 永久

Mar 24, 2010 2010年03月24日

Augusto Pascutti 奥古斯托Pascutti

No need of docs for now I think ...我认为现在没有需要的文件...
There is no need to polish things too much for now, just the base idea of the implementation should do just fine ;]有没有必要波兰现在的东西太多,只是实施的基本想法应该做的就好了;]

  • Permalink 永久

Mar 29, 2010 2010年03月29日

Coen Hyde 科恩海德

Sorry for taking so long.对不起,这么长时间。 I didn't actually spend all that time writing docs我其实没有花所有的时间写作文档 ... ... ... I found a bug that required a significant modification of the source.我发现了一个错误,需要重大修改的源。

Anyway here it is http://github.com/coen-hyde/Shanty-Mongo反正这里是http://github.com/coen-hyde/Shanty-Mongo

The docs are a bit lack luster but it should give you the idea.该文档是有点缺乏光泽,但它应该给你的想法。

Since this adapter is completely different to the proposal above i'll sign Zend's contributor form and create a separate proposal.由于此适配器是完全不同的上述建议,我会签署了Zend的贡献形式和创建一个单独的建议。

One problem with my proposal is it requires php5.3.我的建议的一个问题是它需要PHP5.3。 But i figured the Zend Framework would eventually move to 5.3 or would allow 5.3 only components in the extras.但我想,Zend框架,最终迁移到5.3,或将允许在额外5.3的组件。 It would be possible to modify the adapter to not use late static binding but it should be a last resort as it would significantly reduce the developer friendliness.这将有可能修改适配器,不使用后期静态绑定,但它应该是最后的手段,因为它会显着降低开发人员友好。

Any testing or feedback would is more than welcome.任何测试或反馈欢迎。 Unit tests would be worshiped.单元测试会被崇拜。

  • Permalink 永久

Mar 30, 2010 2010年03月30日,

Coen Hyde 科恩海德

Hi Dennis,您好丹尼斯,

Re Connections: Yeah i haven't put much thought into the connection aspect at all, completely open to suggestion from those who know better.重新连接:我没有连接方面投入过多考虑所有,完全开放,更懂得那些建议。

Re Validators and Filters: I did originally have them separate but it was a bit ugly having the configuration options for properties spread across multiple arrays.重新校验器和过滤器:我没有让他们分开,但它是一个有点难看分散在多个阵列的属性配置选项。 Plus there are other requirements that are not validators or filters such as the 'AsReference' and planned 'AsPartial'.再加上有其他不属于验证器或过滤器,如“AsReference'计划”AsPartial“的要求。 If it this is something that bothers people, maybe we can prefix the requirements, such as 'Filter:{$filterName}' and 'Validator:{$validatorName}'如果这是困扰人们的东西,也许我们可以前缀的要求,如“过滤器:{$ filterName}”和“验证:{$ validatorName}”

Yes closures are supported in 5.3.支持5.3是封。 The reason i have used closures in this instance is to allow the developers to supply custom requirement creators.我已经使用在这种情况下封的原因是为了让开发人员提供定制要求创作者。

  • Permalink 永久

Zend框架:Zend_Nosql_Mong​​o组件建议相关推荐

  1. 理解 Zend 框架

    第 1 部分: 基础 Zend 框架究竟是什么呢?Zend 框架具有以下特征: 是基于 PHP 建立的. 是面向对象的. 使用 MVC 范例. 具有开放源码贡献者. 有贡献者负责保证他们的代码不是他人 ...

  2. php zend框架入门,Zend Framework 入门——快速上手

    1. 安装 从 Zend Framework 的网页上下载最新版本.解压后,把整个目录拷贝到一个理想的地方,比如:/php/library/Zend. 打开 php.ini 文件,确认包含 Zend ...

  3. .NET Core开发实战(第15课:选项框架:服务组件集成配置的最佳实践)--学习笔记...

    15 | 选项框架:服务组件集成配置的最佳实践 这一节讲解如何使用选项框架来处理服务和配置的关系 选项框架的特性: 1.支持单例模式读取配置 2.支持快照 3.支持配置变更通知 4.支持运行时动态修改 ...

  4. 实例演示使用RDIFramework.NET 框架的工作流组件进行业务流程的定义—请假申请流程-Web

    实例演示使用RDIFramework.NET 框架的工作流组件 进行业务流程的定义-请假申请流程-Web 参考文章: RDIFramework.NET - 基于.NET的快速信息化系统开发框架 - 系 ...

  5. 实例演示使用RDIFramework.NET 框架的工作流组件进行业务流程的定义—请假申请流程-WinForm

    实例演示使用RDIFramework.NET 框架的工作流组件 进行业务流程的定义-请假申请流程-WinForm 参考文章: RDIFramework.NET - 基于.NET的快速信息化系统开发框架 ...

  6. php excel 组件,Yii Framework框架使用PHPExcel组件的方法示例

    本文实例讲述了Yii Framework框架使用PHPExcel组件的方法.分享给大家供大家参考,具体如下: PHPExcel下载地址http://www.yiiframework.com/exten ...

  7. XCoreRedux框架:Android UI组件化与Redux实践

    XCoreRedux框架:Android UI组件化与Redux实践 @author: 莫川 https://github.com/nuptboyzhb/ XCoreRedux源码+Demo:http ...

  8. element-ui 框架的checkbox组件:点击事件 与 选中判断 - 代码篇

    vue + element-ui 框架的checkbox组件:点击事件 与 选中判断 代码如下: html部分 <!-- 全选 刷新 --> <div class="btn ...

  9. 关于.NET框架的主要组件 10:45:02

    关于.NET框架的主要组件 10:45:02 为什么需要.NET框架 面向对向编程 强大的web支持 web服务 平板应用 soa,云计算 .net程序 .NET框架主要组件 公共语言运行时 CLR ...

最新文章

  1. Linux网络 - 数据包的发送过程
  2. iphone日历怎么跳转日期_晚上别调手表日期!手表调节日历的禁区!
  3. 证券业震荡,数字化智能化变革、升级与突破或是新生力量(附案例)
  4. 简述一下extern C的小作用
  5. 三维重建:深度相机方案对比-KinectFusion的基本原理(尺度)
  6. python生成器yield原理_Python generator生成器和yield表达式详解
  7. 局部敏感哈希(LSH)
  8. Hihocoder 最近公用祖先三 在线LCA
  9. pytorch出现RuntimeError: CUDA out of memory.
  10. 权限问题导致无法删除ftp文件
  11. MyBatis3_[tp_41-42-43]-_动态sql_trim_自定义字符串截取_choose分支选择_update的set与if-trim 结合的动态更新...
  12. Servlet工作原理解析
  13. ComputeShader
  14. 正则匹配中英文全部特殊符号
  15. 自定义形状seekbar学习
  16. 一个设想:什么是真正的云,及利用树莓派和cloudwall打造你的真正云中心
  17. 使用云主机的5大好处?
  18. 关于商业智能BI,今天只谈这五点
  19. 《数据挖掘概念与技术》学习笔记-第二章
  20. 建模厉器E-RWin

热门文章

  1. 概率论复习笔记二——离散型分布和连续型分布
  2. 学习笔记|领域自适应(Domain adaption)——实现模型的自适应迁移
  3. 气象、生态、遥感、水文、洪水、语言、地质、双碳等领域模型应用教程
  4. 运维工程师必知:什么是千兆交换机?
  5. 微信小程序时间戳转换为日期
  6. DNS域名解析服务正向解析和反向解析
  7. 每日一题 No.4 男女搭配干活不累
  8. 深入机器学习系列之:隐式狄利克雷分布(1)
  9. Android中通过USB接口与和PC进行通讯的demo程序
  10. 苹果应用审核及相关问题解决方法