查询有什么问题?我收到语法错误,但我无法找出任何错误
What is wrong with query? I am getting syntax error, but I cannot figure out anything that's wrong
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)
请帮忙!
$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()
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)
请帮忙!
$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()