--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="JavaScriptLibraryMappings">
+ <file url="file://$PROJECT_DIR$/node" libraries="{Node.js v0.8.14 Core Library}" />
+ <file url="file://$PROJECT_DIR$/tcejdb" libraries="{Node.js v0.8.14 Core Library}" />
+ </component>
+</project>
+
};
+EJDB.prototype.remove = function(cname, oid, cb) {
+ return this._impl.remove(cname, oid, cb);
+};
+
+/**
+ *
+ * Calling variations:
+ * - query(cname, qobj, qobjarr, hints, cb)
+ * - query(cname, qobj, hints, cb)
+ * - query(cname, qobj, cb)
+ *
+ * @param cname
+ * @param qobj
+ * @param orarr
+ * @param hints
+ * @param cb
+ */
+EJDB.prototype.query = function(cname, qobj, orarr, hints, cb) {
+ if (arguments.length == 4) {
+ hints = orarr;
+ cb = hints;
+ orarr = [];
+ } else if (arguments.length == 3) {
+ cb = orarr;
+ orarr = [];
+ hints = {};
+ }
+ if (typeof cb !== "function") {
+ throw new Error("Callback 'cb' argument must be specified");
+ }
+ if (typeof cname !== "string") {
+ throw new Error("Collection name 'cname' argument must be specified");
+ }
+ if (typeof hints !== "object") {
+ hints = {};
+ }
+ if (typeof qobj !== "object") {
+ qobj = {};
+ }
+ return this._impl.query(cname,
+ [qobj].concat(orarr, hints),
+ (hints["onlycount"] ? ejdblib.JBQRYCOUNT : 0),
+ cb);
+};
+
+
module.exports = EJDB;
};
module.exports.testSaveLoad = function(test) {
+ test.ok(jb);
test.ok(jb.isOpen());
var parrot1 = {
"name" : "Grenny",
module.exports.testQuery1 = function(test) {
- test.done();
+ test.ok(jb);
+ test.ok(jb.isOpen());
+ jb.query("parrots", {}, function(err, cursor, count) {
+ test.ifError(err);
+ test.equal(count, 2);
+ test.ok(cursor);
+ var c = 0;
+ while (cursor.next()) {
+ ++c;
+ }
+ test.equal(c, 2);
+
+ test.ifError(err);
+ test.done();
+ });
};
module.exports.testClose = function(test) {