mongo2elastic
Version:
Sync MongoDB collections to Elasticsearch
14 lines (13 loc) • 484 B
JavaScript
export const indexFromCollection = (collection) => collection.collectionName.toLowerCase();
export const indexFromDbAndCollection = (collection) => `${collection.dbName.toLowerCase()}_${collection.collectionName.toLowerCase()}`;
/**
* Does arr start with startsWith array.
*/
export const arrayStartsWith = (arr, startsWith) => {
for (let i = 0; i < startsWith.length; i++) {
if (arr[i] !== startsWith[i]) {
return false;
}
}
return true;
};