saintedlama / mongoose-version

Mongoose plugin to save document data versions. Documents are saved to a "versioned" document collection before saving original documents and kept for later use.
BSD 2-Clause "Simplified" License
144 stars 35 forks source link

How to query versions? #41

Closed 4ndre4s closed 4 years ago

4ndre4s commented 4 years ago

I created a Schema as described in the documentation:

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var version = require('mongoose-version');

var Page = new Schema({
  title : { type : String, required : true},
  tags : [String],

  lastModified : Date,
  created : Date
});

Page.plugin(version, { collection: 'Page__versions' });

How can I query Page__versions without having a model to import?

4ndre4s commented 4 years ago

Solved by using database object