db.haidb.find({
"Provider ID": {
"$exists": true
},
"Address": {
"$exists": true
},
"City": {
"$exists": true
},
"Measure ID": {
"$regex": /^HAI_1.*SIR$/
},
{
"$or": ["State": {
"$regex": /^A/i
}, "State": {
"$regex": /^N/i
}]
},
{
"$and": [{
"Compared to National": "Better than the National Benchmark"
}, {
"Score": {
"$gte": 0.5
}
}]
}
}).sort({
"Hospital Name": 1.0
}).pretty()
這是 Mongo 拋出的:SyntaxError: Unexpected token (1:153)
請幫忙!
uj5u.com熱心網友回復:
和部分未正確放置$or。$and這將起作用。
db.haidb.find({
"Provider ID": {"$exists": true},
"Address": {"$exists": true},
"City": {"$exists": true},
"Measure ID": {"$regex": /^HAI_1.*SIR$/},
"$or": [
{"State": {"$regex": /^A/i}},
{"State": {"$regex": /^N/i}}
],
"Compared to National": "Better than the National Benchmark",
"Score": {"$gte": 0.5}
}).sort({
"Hospital Name": 1.0
}).pretty()
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/435727.html
