mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
42
node_modules/mquery/lib/collection/collection.js
generated
vendored
Normal file
42
node_modules/mquery/lib/collection/collection.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* methods a collection must implement
|
||||
*/
|
||||
|
||||
var methods = [
|
||||
'find'
|
||||
, 'findOne'
|
||||
, 'update'
|
||||
, 'remove'
|
||||
, 'count'
|
||||
, 'distinct'
|
||||
, 'findAndModify'
|
||||
, 'aggregate'
|
||||
, 'findStream'
|
||||
];
|
||||
|
||||
/**
|
||||
* Collection base class from which implementations inherit
|
||||
*/
|
||||
|
||||
function Collection () {}
|
||||
|
||||
for (var i = 0, len = methods.length; i < len; ++i) {
|
||||
var method = methods[i];
|
||||
Collection.prototype[method] = notImplemented(method);
|
||||
}
|
||||
|
||||
module.exports = exports = Collection;
|
||||
Collection.methods = methods;
|
||||
|
||||
/**
|
||||
* creates a function which throws an implementation error
|
||||
*/
|
||||
|
||||
function notImplemented (method) {
|
||||
return function () {
|
||||
throw new Error('collection.' + method + ' not implemented');
|
||||
}
|
||||
}
|
||||
|
||||
13
node_modules/mquery/lib/collection/index.js
generated
vendored
Normal file
13
node_modules/mquery/lib/collection/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var env = require('../env')
|
||||
|
||||
if ('unknown' == env.type) {
|
||||
throw new Error('Unknown environment')
|
||||
}
|
||||
|
||||
module.exports =
|
||||
env.isNode ? require('./node') :
|
||||
env.isMongo ? require('./collection') :
|
||||
require('./collection');
|
||||
|
||||
100
node_modules/mquery/lib/collection/node.js
generated
vendored
Normal file
100
node_modules/mquery/lib/collection/node.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var Collection = require('./collection');
|
||||
var utils = require('../utils');
|
||||
|
||||
function NodeCollection (col) {
|
||||
this.collection = col;
|
||||
this.collectionName = col.collectionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* inherit from collection base class
|
||||
*/
|
||||
|
||||
utils.inherits(NodeCollection, Collection);
|
||||
|
||||
/**
|
||||
* find(match, options, function(err, docs))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.find = function (match, options, cb) {
|
||||
this.collection.find(match, options, function (err, cursor) {
|
||||
if (err) return cb(err);
|
||||
|
||||
cursor.toArray(cb);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* findOne(match, options, function(err, doc))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.findOne = function (match, options, cb) {
|
||||
this.collection.findOne(match, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* count(match, options, function(err, count))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.count = function (match, options, cb) {
|
||||
this.collection.count(match, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* distinct(prop, match, options, function(err, count))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.distinct = function (prop, match, options, cb) {
|
||||
this.collection.distinct(prop, match, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* update(match, update, options, function(err[, result]))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.update = function (match, update, options, cb) {
|
||||
this.collection.update(match, update, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* remove(match, options, function(err[, result])
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.remove = function (match, options, cb) {
|
||||
this.collection.remove(match, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* findAndModify(match, update, options, function(err, doc))
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.findAndModify = function (match, update, options, cb) {
|
||||
var sort = Array.isArray(options.sort) ? options.sort : [];
|
||||
this.collection.findAndModify(match, sort, update, options, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* var stream = findStream(match, findOptions, streamOptions)
|
||||
*/
|
||||
|
||||
NodeCollection.prototype.findStream = function(match, findOptions, streamOptions) {
|
||||
return this.collection.find(match, findOptions).stream(streamOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* aggregation(operators..., function(err, doc))
|
||||
* TODO
|
||||
*/
|
||||
|
||||
/**
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = exports = NodeCollection;
|
||||
|
||||
Reference in New Issue
Block a user