-2
創建春本地查詢如何從春MongoDB中創建本地查詢是這樣的:如何在MongoDB中
db.testz.aggregate([{
$match: {
fp: {
$in: ['100.100', '700.700', '5000.5000', '990000.990000', '777000.777000',
'330000.330000', '705000.705000', '350000.350000', '800000.800000', '200000.200000'
]
}
}
}, {
$group: {
_id: {
uuid: '$uuid'
},
count: {
$sum: 1
},
fps: {
$push: '$fp'
}
}
}, {
$project: {
'count': 1,
'_id': 0,
'uuid': '$_id',
'fps': 1
}
}, {
$match: {
count: {
$gt: 1
},
$or: [{
$and: [{
fps: '100.100'
}, {
fps: '800000.800000'
}]
}, {
$and: [{
fps: '350000.350000'
}, {
fps: '990000.990000'
}]
}, {
$and: [{
fps: '330000.330000'
}, {
fps: '5000.5000'
}]
}, {
$and: [{
fps: '705000.705000'
}, {
fps: '777000.777000'
}]
}, {
$and: [{
fps: '200000.200000'
}, {
fps: '700.700'
}]
}]
}
}, {
$group: {
_id: {
uuid: '$count'
},
count: {
$sum: 1
}
}
}, {
$project: {
'count': 1,
'_id': 0
}
}, ]);