How to store separate versions of document for a blog using mongodb with nodejs? - node.js

I am creating a blog site but i would like to add the feature to have history for a blog what changes are been done in previous version and latest version. Creating a separate history collection will be one approach but what about the document do i need to just copy the document of old revision in history collection or the just the json diff . If we just store the diff of field what will be the base object to construct the upto date document till that revision if we wish to query document with specific revision suppose (__version: 15) and current version will be somewhere 25.

I'd go with your first option, using a history collection, since it would be easier to fetch an entire document than keeping lot of diffs and then having to sync them all together. Also, having a different collectiont would be a faster solution, since you wouldn't need to fetch for different versions, assemble them and display it.
But on the other side, if you just want to show minor changes, like on facebook when you edit a comment, I think the diff approach would be the best option, altough you'd have to keep references on where and what has changed

Related

Kentico 8.2 - Is there a way to delete Attachment History from the GUI

Our attachments have been stored in our database for a very long time, and it has caused the database to become huge and our backups to be extremely unreliable. We have moved our attachments to the file system and that shaved off a great deal of size.
Now our largest table is CMS_AttachmentHistory. I've been able to test brute force deleting every row in SQL (and every row in the CMS_VersionAttachment junction table). But is there a way to accomplish this in the Kentico Admin GUI without having to resort to this?
When I say brute force delete, I mean:
DELETE FROM dbo.CMS_VersionAttachment
DELETE FROM dbo.CMS_AttachmentHistory
There is an option in the GUI that will do this, but it's also going to impact the page version history. If you go to Settings > Content > Content management and look in the Workflow section, you can see a setting named Version history length. Reducing this to a lower number (I believe 20 is the default) will reduce the version history stored to reflect the new value by deleting the unneeded rows.
This will affect all version history though, not just the attachment, but also the pages themselves. That being the case, you would need to decide if you need/want to keep the version history of the pages or not.
If you don't want to lose that history, then I'd say that a good option would be to write a script that can set the AttachmentBinary column to null for the records that you don't need/want (given that you say that you now store the files on the filesystem, any current versions will have the correct value, so this is probably all of them)
Not sure about 8.2. But you can try to experiment with recycle bin/objects. There are a couple topics: topic 1 and topic 2. I just check it puts there attachment every time you delete it, even though I have in setting "files on disc". You can do like Kentico recommends set binary field to null or write script using API.

Moving documents from one document library to another with SharePoint 2013 Workflow using list item information

To preface: I believe this may be impossible with OOTB solutions and if it is I have a plan B, but this plan would be much easier to implement if it is indeed possible.
Is there any way to create a SharePoint workflow that moves a file from a separate document library to another separate library?
The workflow is launched when a new item is created in a list. The item contains the information needed to find the document that it's referencing (ID, path, folder path, name etc...). Is it possible to take this information and then move the file being referenced to another library using a SharePoint workflow?
The document can't be simply copied because version history must stay with the document. I'm also unable to run the workflow in the library that contains the document because it's deciding on what documents to move based on the last modified date and as soon as the document is touched by the workflow it's been modified.
If you only want to copy files with metadata, we can use the OOTB workflow to achieve it.
If you want to copy files with version history, please check the Nintex workflow.
Nintex Workflow Move Document and Preserve Version History
Or we can create event receiver with custom code to achieve it.
Copy files between libraries by keeping versions

GridFS: Clean out all unreferenced files

I have just moved towards storing things in my GridFS in MongoDB. During testing, I noticed many files are being created but not deleted properly. I have a collection users, which has a field avatar. It contains the ObjectId of the file.
Now I'd like to have some command I could use to remove all the files and chunks that are not referenced there. Is it possible to do that with one query? Maybe 'map-reduce'?
Also I am not sure how to properly delete GridFS-Files in node-mongodb-native properly.
? Now I'd like to have some command I could use to remove all the files and chunks that are not referenced there.
Key terms here is "referenced". MongoDB does not have any joins and therefore, it does not have concept of "references".
Maybe 'map-reduce'?
Map / Reduce is a query tool, not a data modification tool. The same is true of the newer "Aggregration Framework".
What you will have to do is loop through your files and check the references for each one individually. You will then be able to delete those files.
Take a look at some documented examples on how to issue those deletions.

How to export work items from one TFS server to another TFS server using Excel

I need to migrate Work Items from one TFS server to another TFS server. I tried migrating them using the TFSMigration tool available in CodePlex.
The problem I am encountering is the schema for the work item on the source TFS is different from the schema of the work item type on destination. I don't want the destination TFS server schema for the work item to be modified. The change in schema is one new column only, but still don't want to take that change.
In one blog it was said that we can do that using Excel but not much details were available. I am not sure we can even use Excel to migrate the entire history related to Excel.
Have a look at the TFS Integration Tools on VS gallery. This supports custom field mappings as part of a migration, documentation here (direct download).
I did this a while back and, not finding an appropriate tool, resorted to copying the title and description etc across manually, as we only had a few active work items at the time, so it only took about an hour.
however, if I need to do it again, I'll use the TFS API to read fields of interest and write them to the new database. that way any schema differences don't matter, and the process is automated but under your control. Search for studying work items with the TFS API for details - it's really very easy.
Of course with both of these approaches (and all the migration tools AFAIK) you will only get a snapshot of the data - all history will be lost (or at best you can query using AsOf to get historical data, but all the entries you make will be timestamped at the moment you write them, not with the historical time that the event originally occurred.)
You can use the Excel editor to edit the source query All Items "Open Query in Microsoft Excel". Then open the destination query All Items "Open Query in Microsoft Excel". Copy and paste the contents from one excel window to the other. Certain fields like attachments will not transfer.

Sharepoint: Modify the versions of a file/item

Is it possible to manually add and modify the versions of a document using the object model?
As example I want to be able to get the SPListItemVersion object of a document and modify its properties. It seems to me that all properties are read-only, so it is not possible to modify anything.
Is there any workaround for this availalbe? I need this functionality for importing multiple document versions.
When I implemented an option to move documents between sites, a similar problem came up. What you can is push versions into the item.Versions array, and I found an online sample at http://www.k2distillery.com/2009/10/copy-splistitemversion.html
Look for the //loop over the soureitem, restore it comment.

Resources