Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.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
查询以获取MongoDB中特定键的值_Mongodb_Collections_Nosql_Mongodb Query_Mongoid - Fatal编程技术网

查询以获取MongoDB中特定键的值

查询以获取MongoDB中特定键的值,mongodb,collections,nosql,mongodb-query,mongoid,Mongodb,Collections,Nosql,Mongodb Query,Mongoid,我有一个集合,其中包含以下格式的记录 { "_id" : 21, "title" : "3D User Interfaces with Java 3D", "isbn" : "1884777902", "pageCount" : 520, "publishedDate" : ISODate("2000-08-01T07:00:00Z"), "thumbnailUrl" : "https://s3.amazonaws.com/AKIAJC5RLADLUMVRPFDQ.book-thumb-imag

我有一个集合,其中包含以下格式的记录

{
"_id" : 21,
"title" : "3D User Interfaces with Java 3D",
"isbn" : "1884777902",
"pageCount" : 520,
"publishedDate" : ISODate("2000-08-01T07:00:00Z"),
"thumbnailUrl" : "https://s3.amazonaws.com/AKIAJC5RLADLUMVRPFDQ.book-thumb-images/barrilleaux.jpg",
"longDescription" : "3D User Interfaces with Java 3D is a practical guide for providing next-generation applications with 3D user interfaces for manipulation of in-scene objects. Emphasis is on standalone and web-based business applications, such as for online sales and mass customization, but much of what this book offers has broad applicability to 3D user interfaces in other pursuits such as scientific visualization and gaming.  This book provides an extensive conceptual framework for 3D user interface techniques, and an in-depth introduction to user interface support in the Java 3D API, including such topics as picking, collision, and drag-and-drop. Many of the techniques are demonstrated in a Java 3D software framework included with the book, which also provides developers with many general-purpose building blocks for constructing their own user interfaces.    Applications and their use of 3D are approached realistically. The book is geared towards sophisticated user interfaces for the \"everyday user\" who doesn't have a lot of time to learn another application--much less a complicated one--and an everyday computer system without exotic devices like head mounted displays and data gloves. Perhaps the best description of this book is: \"A roadmap from Java 3D to 'Swing 3D'.\"",
"status" : "PUBLISH",
"authors" : [
    "Jon Barrilleaux"
],
"categories" : [
    "Java",
    "Computer Graphics"
]
}

我要做的是从集合中提取所有标题值

我试着使用类似于:

db.<Collection_name>.find(title)
但它返回一个错误作为ReferenceError:title未定义

请提供您的建议,以使此工作正常。

方法有两个参数:第一个参数用于查询,您可以传递一个空对象,第二个参数定义应返回哪些字段的投影,因此您的查询应如下所示:

db.<Collection_name>.find({}, { title: 1 })