Sunday, May 21, 2017

How to take MongoDB data Backup

In Sitecore’s xDB, MongoDB is used primarily for collecting data. Information about visitors and their interactions is written to MongoDB as flat JSON, which is then processed by an aggregation pipeline into a format that is used for reporting.

The mongodump and mongorestore utilities work with BSON data dumps.

To backup data from a mongod or mongos instance running on the same machine and on the default port of 27017, use the following command:

mongodump --out “new db location path”


Sunday, April 30, 2017

Sitecore Version Pruner Command

Sitecore Version Pruner Command:

It is just a scheduled task that you can configure to remove old/unused versions from your content tree.

  • Install the appropriate Sitecore package
  • In Content Editor, navigate to: /sitecore/System/Tasks/Commands/Run Version Pruner
  • Set the "Root" field to the item from which to start pruning versions. Change other fields as required.
  • In Content Editor, navigate to: /sitecore/System/Tasks/Schedules/Version Pruner Schedule
  • Modify the "Schedule" field to your desired run scheduled. 


How to override Sitecore Version Pruner Command –

    public class VersionPrunerCommand : Sitecore.SharedSource.VersionPruner.Tasks.VersionPrunerCommand
        protected override void ProcessItemTree(Item item)
            if (Sitecore.Context.Job != null)

            // Get the item in all languages
            foreach (var itemLanguage in item.Languages)
                var languageItem = item.Database.GetItem(item.ID, itemLanguage);
                if (languageItem.Versions.Count > 0)
                    Sitecore.Context.Job.Status.Messages.Add("processing: " + item.Paths.Path + ", " + item.Language.Name);

                    // Run item against the Item Filter rule(s)
                    var ruleContext = new RuleContext();
                    ruleContext.Item = languageItem;

                    if (ruleContext.Parameters.ContainsKey("ItemValidForVersionRemoval"))
                        // Rule was passed, so this item's versions should be trimmed..

            // Process all descendant items
            foreach (Item child in item.Children)

I hope you like this. Stay tuned for more Sitecore related articles.

Happy Sitecoring :)

Please leave your comments or share this tip if it’s useful for you.