我使用Nodejs后端和MongoDB来保存我的对象结构,使用Mongoose作为ORM。
我有一个工作订单对象,它遵循以下模式。有数千个生成的工单,我需要找到在给定日期分配给给定工人的工单。
你能帮我提一下查找查询吗?
查询详情
allocatedWorker
(工作人员)和allocatedDateTime
(日期和时间)来匹配和查找 Work order
对象
{
customer: String,
address: String,
/**
* List of to do items. Each item will mainly belong in to a given category
* and a collection of tasks.
* The task can be system generated, admin assigned or customer raised.
*/
todo: [
{
category: String,
/**
* A collection of raised tasks
*/
tasks: [
{
/**
* Holds the customer request details
*/
request: {
workItem: String,
instructions: String,
/**
* Preferred date and time
*/
dateTime: String,
/**
* Preferred worker if any
*/
preferredWorker: String,
receivedDateTime: String
},
/**
* Details of the schedule
*/
schedule: [
{
/**
* Allocated worker's user name
*/
allocatedWorker: String,
allocatedDateTime: String,
allocatedDuration: Number,
/**
* Schedule changed date and time
*/
scheduledOn: String,
/**
* Scheduler's user name
*/
scheduledBy: String,
/**
* Scheduled task status
* 0: Pending - new
* 1: Scheduled - allocated
* 2: Work In Progress
* 3: Completed
* 4: Overdue
*/
itemStatus: Number
}
],
/**
* Stage of the work order
* 0: Pending - new
* 1: Scheduled - allocated
* 2: Work In Progress
* 3: Completed
* 4: Overdue
*/
status: Number
}
]
}
]
}
答案 0 :(得分:1)
尝试以下查询:
<video id="video-area" controls>
<source src="videos/person.mp4" type="video/mp4">
</video>
请记住,两者都将执行存储在db。
中的精确值匹配(确切名称和日期时间)