本文介绍了如何在Kohana中使用MongoDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请给我一些如何在Kohana [v3.2]中使用MongoDB的启动指南.

Please, give me some startup guidance on how to use MongoDB in Kohana[v3.2].

我从以下位置下载了Kohana模块用于kohana的Mongo模块,并已为PHP设置了MongoDB驱动程序.现在,我正在尝试创建一个新数据库并将记录保存到其中.

I downloaded the Kohana Module from Mongo Module for kohana and have set up the MongoDB driver for PHP. Now I'm trying to create a new database and to save a record into it.

推荐答案

您实际上不需要链接到的Kohana的MangoDB模块.您可以只使用PHP的MongoDB本机驱动程序. mongo查询语言非常简单,如果您知道一些MySQL,那么此页面会有所帮助...

You Don't actually need the MangoDB module for Kohana that you linked to. You can just use PHP's MongoDB Native Driver. The mongo query language is pretty simple, if you know some MySQL then this page would help...

http://www.php.net/manual/en/mongo. sqltomongo.php

这里是使用驱动程序的示例,它连接,启动并插入新的集合中,然后选择集合中的所有数据...

Here is an example using the driver, it connects, starts and inserts into a new collection and then selects the all the data in the collection...

$m = new Mongo();

$db = $m->my_database;

$db->my_new_collection->insert(array("a" => 1, "b" => 1));

$found_data = $db->my_new_collection->find();

http://www.php.net/manual/zh-CN中查看更多/mongo.manual.php

如果您想使用MangoDB,那么我建议阅读代码并检查kohana论坛以获取有关其信息.

If you want to use MangoDB then I suggest reading the code and checking the kohana forums for info on it.

http://forum.kohanaframework.org/search?Search=mangodb

这篇关于如何在Kohana中使用MongoDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 03:21