export data from specific date
This commit is contained in:
@@ -24,6 +24,10 @@ module.exports = {
|
||||
channels: {
|
||||
mergeDiscussionIntoParent: true,
|
||||
},
|
||||
posts: {
|
||||
// Экспортировать посты только начиная с этой даты (ISO 8601). Если не задано - экспортируются все посты.
|
||||
fromDate: '2026-05-18T00:00:00.000Z',
|
||||
},
|
||||
user: {
|
||||
globalRoleMap: {
|
||||
admin: 'system_admin',
|
||||
|
||||
@@ -16,8 +16,10 @@ module.exports = async function (context) {
|
||||
let written = 0
|
||||
|
||||
let memReplyIds = {}
|
||||
const total = await collection.count()
|
||||
const cursor = collection.find()
|
||||
const fromDate = _.get(context, 'config.define.posts.fromDate')
|
||||
const query = fromDate ? { ts: { $gte: new Date(fromDate) } } : {}
|
||||
const total = await collection.count(query)
|
||||
const cursor = collection.find(query)
|
||||
while (await cursor.hasNext()) {
|
||||
const result = await cursor.next()
|
||||
let posts = await collectPostData(context, result, memReplyIds, false)
|
||||
|
||||
Reference in New Issue
Block a user