Added count and aggregate operations to MongoDB In node

This commit is contained in:
Anna Thomas
2014-09-10 14:13:59 +01:00
parent 54a2923c65
commit bc8acd24ae
4 changed files with 95 additions and 18 deletions

View File

@@ -25,7 +25,19 @@ function ensureString(o) {
return ""+o;
}
function ensureBuffer(o) {
if (Buffer.isBuffer(o)) {
return o;
} else if (typeof o === "object") {
o = JSON.stringify(o);
} else if (typeof o !== "string") {
o = ""+o;
}
return new Buffer(o);
}
module.exports = {
ensureString: ensureString,
ensureBuffer: ensureBuffer,
};