以下是我拥有或尝试查询
的架构示例{
"_id" : ObjectId("5139f9468efdd10e44000024"),
"name" : "Test Test",
"account_activities" : [
{
"_id" : ObjectId("5139f9468efdd10e44000025"),
"activity_id" : ObjectId("5139f6118efdd10e4400000e"),
"allowance" : 100,
"base_rate" : {
"cents" : 80,
"currency_iso" : "USD"
},
"excess_rate" : {
"cents" : 90,
"currency_iso" : "USD"
},
"quota" : 100,
"taxable" : true,
"description" : "",
"sm" : 1,
"updated_at" : ISODate("2015-07-24T16:18:50.942Z")
}
],
"account_number" : "D-061-5556",
"active" : false,
"balance" : {
"cents" : 0,
"currency_iso" : "USD"
},
}
在运行$unwind
时,我什么都没得到,有什么我做错了吗?
db.accounts.aggregate([{$unwind: "$account_activities"}, {$project: {_id: 0, name: 1, base_rate: 1}}])
我使用的是mongo shell版本2.6.12
答案 0 :(得分:1)
db.accounts.aggregate([
{$unwind: "$account_activities"},
{$project: {
_id: 0,
name: 1,
'account_activities.base_rate': 1
}}
])
仍在document = PDDocument.load(new File(pdfFilename));
PDFRenderer pdfRenderer = new PDFRenderer(document);
int pageCounter = 0;
for (PDPage page : document.getPages()) {
BufferedImage bim = pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageCounter++) + ".tif", 300);
}
下。所以你必须按如下方式进行投影
{{1}}