Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP仅显示MongoDB中选定的文档(列)?_Php_Database_Mongodb - Fatal编程技术网

使用PHP仅显示MongoDB中选定的文档(列)?

使用PHP仅显示MongoDB中选定的文档(列)?,php,database,mongodb,Php,Database,Mongodb,我使用的是使用PHP的MongoDB,下面是 我的连接详细信息我正在尝试从内部数组中排除[Type] $collection= $client->DB->collection; $currentdate = date("Y-m-d"); $filter = ['date' => $currentdate]; $options = []; $cursor= $collection->find($filter, $options)->

我使用的是使用PHP的MongoDB,下面是 我的连接详细信息我正在尝试从内部数组中排除[Type]

$collection= $client->DB->collection;

$currentdate = date("Y-m-d");

$filter = ['date' => $currentdate];
 
$options = [];
    
$cursor= $collection->find($filter, $options)->toArray(); 
这是我的模式

    _id: objectID("abc47474790bc");
title: Hi here is news
summary: news is all about
newData[

[0]

title: first time life
id: 1
summary: there is some time
type: school
date: 22-9-2020

[1]

title: during all daytime
id: 2
summary: Matthew Carlsen
type: college
date: 22-9-2020

[3]

title: Kids love to be part of
id: 2
summary: Every day when we are
type: Elementary
date: 22-9-2020 
我试图从数组中排除要打印的type:elemental,我该如何做