Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion convertors/move-timestamp-out-of-payload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require('dotenv').config();
require('process');
const { MongoClient } = require('mongodb');

/**
Expand All @@ -6,9 +7,9 @@
*/
const documentsSelectionLimit = 10000;

/**

Check warning on line 10 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @returns declaration
* @param db - mongo db instance

Check warning on line 11 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @param "db" type
* @param collectionName - name of the collection to be updated

Check warning on line 12 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @param "collectionName" type
*/
async function movePayloadTimestampToEventLevel(db, collectionName) {
const collection = db.collection(collectionName);
Expand Down Expand Up @@ -53,10 +54,10 @@
* @param repetitionCollectionName - repetitions collection to be updated
* @param projectId - project id of current repetitions collection
*/
async function backfillTimestampsFromEvents(db, repetitionCollectionName, projectId) {

Check warning on line 57 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @returns declaration
const repetitions = db.collection(repetitionCollectionName);

Check warning on line 58 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @param "db" type
const events = db.collection(`events:${projectId}`);

Check warning on line 59 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @param "repetitionCollectionName" type

Check warning on line 60 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

Missing JSDoc @param "projectId" type
let bulkOps = [];
let repetitionCount = 1;

Expand Down Expand Up @@ -126,13 +127,13 @@
* Method that runs convertor script
*/
async function run() {
const fullUri = 'mongodb://hawk_new:evieg9bauK0ahs2youhoh7aer7kohT@rc1d-2jltinutse1eadfs.mdb.yandexcloud.net:27018/hawk_events?authSource=admin&replicaSet=rs01&tls=true&tlsInsecure=true';
const fullUri = process.env.MONGO_EVENTS_DATABASE_URI;

// Parse the Mongo URL manually
const mongoUrl = new URL(fullUri);
const databaseName = 'hawk_events';

// Extract query parameters

Check warning on line 136 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

'repetition' is not defined

Check warning on line 136 in convertors/move-timestamp-out-of-payload.js

View workflow job for this annotation

GitHub Actions / ESlint

'repetitionCollectionsToCheck' is not defined
const queryParams = Object.fromEntries(mongoUrl.searchParams.entries());

// Compose connection options manually
Expand Down
Loading