Home  >  Article  >  Backend Development  >  php怎么查询MongoDB中存储的数组?

php怎么查询MongoDB中存储的数组?

WBOY
WBOYOriginal
2016-06-06 20:20:401551browse

我现在遇到的问题是别人在mongodb中存储的图片信息,keyimg,value为一个url数组。
当我利用phpmongodb扩展来查询时,img域返回的是一个字符串,但是我希望得到的是存入的数组对象,请问有什么方法可以获取到一个数组类型的对象呢?
我查询使用的是MongoCursor::find()这个API。NoSQL数据库我也是第一次使用╮(╯-╰)╭。。

回复内容:

我现在遇到的问题是别人在mongodb中存储的图片信息,keyimg,value为一个url数组。
当我利用phpmongodb扩展来查询时,img域返回的是一个字符串,但是我希望得到的是存入的数组对象,请问有什么方法可以获取到一个数组类型的对象呢?
我查询使用的是MongoCursor::find()这个API。NoSQL数据库我也是第一次使用╮(╯-╰)╭。。

我没用过,不过可以试下 存的时候 json_encode(), 取出来后在json_decode()

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn