亲爱的尝试在 mongo 中按日期过滤,但我没有成功。我传递了我的查询和 JSON 结构。
db.getCollection('articles').aggregate([
{ "$match": {
"$expr": {
"$and": [
{
"$gte": [
{ "$dateFromString": { "creationDate": "10-08-2018", "format": "%m-%d-%Y" }}
]
},
{
"$lte": [
{ "$dateFromString": { "creationDate": "10-08-2018", "format": "%m-%d-%Y" }}
]
}
]
}
}}
])
Run Code Online (Sandbox Code Playgroud)
我的 JSON 是
{
"_id" : ObjectId("5bbb6b1de75b933850a608fc"),
"title" : "05",
"body" : "asgfasgasfa",
"creationDate" : ISODate("2018-10-08T14:35:07.000Z"),
"operationType" : "C",
"__v" : 0
}
Run Code Online (Sandbox Code Playgroud)
MongoDB:v3.6.3
I am experiencing extreme slowness with mongo. Earlier when I put sudo systemctl status mongodb mongo I appeared Online and in green. Now after a few days he started to throw me away
mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-11-29 08:55:07 -03; 3 days ago
Process: 13231 ExecStart = / usr / bin / mongod --quiet --config /etc/mongod.conf (code = exited, status = 48)
Main PID: 13231 …Run Code Online (Sandbox Code Playgroud)