我有一个集合,其中包含以下格式的记录。
{
"_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:标题未定义。
请提供您的建议以使这项工作成功。
答案 0 :(得分:1)
.find()方法有两个参数:第一个参数用于查询(您可以传递一个空对象),第二个参数定义一个投影(应返回哪些字段),因此查询应类似于:
caseInsensitiveCompare := [ :a :b | | result |
result := a compare: b caseSensitive: false.
"equal ignoring case"
result = 2 ifTrue: [ a compare: b caseSensitive: true ].
"less than, so return true (else return false since result=2)"
result = 1 ].
slist := list asSortedCollection: caseInsensitiveCompare.
"a SortedCollection('A' 'a' 'C' 'c' 'z')"