【发布时间】:2013-05-09 07:01:37
【问题描述】:
注意:第一次使用 MongoDB。
技术:php mongodb 场景:
数据假设包含提供的程序。文档如下:
{
LocationName: 'name of the location',
LocationAddress: 'Main street., Popular City, PC',
LocationManager: 'Mr. Manager',
LocationPhone: '555 555 1212',
Programs :
[
{
ProgramName : 'Excellence Prgram',
ProgramStartDate : '12-05-2012',
ProgramEndDate : '3-15-2013'
},
{
ProgramName : 'Excellence Prgram for me',
ProgramStartDate : '1-05-2012',
ProgramEndDate : '2-15-2013'
},
{
ProgramName : 'Excellence Prgram for three',
ProgramStartDate : '1-05-2012',
ProgramEndDate : '4-15-2013'
}
]
}
问题:
- 要按开始和结束日期查询,集合查询是什么?
- 程序将在结束日期到期,并且经常将新程序添加到每个文档中。我认为在文档中保留过期的程序在某些时候会变得低效。如何归档过期的程序?
提前谢谢你。
【问题讨论】:
-
显然这是一个很难解决的问题。
标签: mongodb mongodb-php