All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.3.0.0.5-remove-orphan-documentation-pages.js Maven / Gradle / Ivy

The newest version!
print('find all orphan pages and remove them from db')
db.pages.find({parentId: {$exists: true}}).forEach(doc => {
  const parentCursor = db.pages.find({_id: doc.parentId});
  if (!parentCursor.hasNext()) {
    //printjson(doc);  
    db.pages.remove(doc);  
  }
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy