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