Snapshots
Mongo Interface provides only general native mongo functionality. We decided to amplify some functions and add an extra opportunities for data manipulation.
Snapshots are objects that are stored in the site-{site.id}-snapshots collection.
They are created once you save the object in the database using save function.
just.save([object])
Inserts a new document or updates the existing one in the collection and creates the snapshot of this document. Returns Promise object.
just
.save([{"_type": "Country", name: "Australia", language: "English"}])
.then(function(res) {
// your code here
})[NOTE]: If you don't want some fields to be saved in the snapshot you can put them into _persist key. It won't be added to snapshot mask.
just.snapshots(query, projection)
Selects the snapshots defined by query in the collection.
projection param is similar to one in find method. Returns Promise object.
just
.snapshots([{}])
.then(function(res) {
// your code here
})just.snapshots_one(query, projection)
Selects one snapshot defined by query in the collection.
projection param is similar to one in find method. Returns Promise object.
just
.snapshots_one([{}])
.then(function(res) {
// your code here
})just.snapshots_revert(snapshot_id)
Reverts a snapshot of the object to the previous one. Accepts snapshot_id - an id of the target snapshot. Returns Promise object.
just
.snapshots_revert("c3e4a8c585ce4e1eec00fe53ebb79490")
.then(function(res) {
// your code here
})