Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は試します:
$fields = array('name'=>true); find (array(array(), $fields))
しかし、それは機能しておらず (何も得られません)、自分の間違いがわかりません。ごめん :(
すべてのレコードで特定のフィールドを探している場合は、次のようにすることができます。
$cursor = $collection->find(); foreach( $cursor->fields(array('myField' => true )) as $doc ) { echo "<pre>"; var_dump($doc); echo "</pre>";
これは、コレクション内の各ドキュメントに対して「myFeild」のみを返します。
http://php.net/manual/en/mongocursor.fields.php