有会mongoDB数据库的吗?

{

    id: "1111",

title: "111zdcy111",

create_time: ISODate("2022-08-08T06:48:15.921+0000")

update_time: ISODate("2022-08-08T06:48:15.921+0000")

}

如何查询 collection test里title包含"zdcy"或create_time大于昨天下午3点的前20条数据,并按照update_time升序

这该怎么写啊?

试一下这个语句。

db.test.insertMany( [
{
id: "1111",
title: "111zdcy111",
create_time: ISODate("2022-08-08T06:48:15.921+0000"),
update_time: ISODate("2022-08-08T06:48:15.921+0000")
}
]);

db.test.find(
    { $or: [ { title: /zdcy/ } ,
             { create_time: {"$gt": ISODate("2022-09-18T15:00:00.000Z")} } ] }
).sort( { update_time: 1 } ).limit(20)

> db.test.find(
...     { $or: [ { title: /zdcy/ } ,
...              { create_time: {"$gt": ISODate("2022-09-18T15:00:00.000Z")} } ] }
... ).sort( { update_time: 1 } ).limit(20)
{ "_id" : ObjectId("63282d2dd8ecdbc578509f95"), "id" : "1111", "title" : "111zdcy111", "create_time" : ISODate("2022-08-08T06:48:15.921Z"), "update_time" : ISODate("2022-08-08T06:48:15.921Z") }