#1
authoradam <anton@adamansky.com>
Fri, 2 Nov 2012 17:05:55 +0000 (00:05 +0700)
committeradam <anton@adamansky.com>
Fri, 2 Nov 2012 17:05:55 +0000 (00:05 +0700)
node/ejdb.js
node/ejdb_native.cc
node/nbproject/configurations.xml
node/tests/t2.js

index dec707b..50b9769 100644 (file)
@@ -67,6 +67,10 @@ EJDB.prototype.save = function(cname, jsarr, cb) {
     });
 };
 
+EJDB.prototype.load = function(cname, oid, cb) {
+    return this._impl.load(cname, oid, cb);
+};
+
 
 module.exports = EJDB;
 
index b2b0fab..f84a566 100644 (file)
@@ -127,7 +127,7 @@ namespace ejdb {
             }
             case BSON_STRING:
             case BSON_SYMBOL:
-                return scope.Close(String::New(bson_iterator_string(it), bson_iterator_string_len(it)));
+                return scope.Close(String::New(bson_iterator_string(it), bson_iterator_string_len(it) - 1));
             case BSON_NULL:
                 return scope.Close(Null());
             case BSON_UNDEFINED:
@@ -207,10 +207,10 @@ namespace ejdb {
                 case BSON_SYMBOL:
                     if (obt == BSON_ARRAY) {
                         ret->Set(knum,
-                                String::New(bson_iterator_string(it), bson_iterator_string_len(it)));
+                                String::New(bson_iterator_string(it), bson_iterator_string_len(it) - 1));
                     } else {
                         ret->Set(String::New(key),
-                                String::New(bson_iterator_string(it), bson_iterator_string_len(it)));
+                                String::New(bson_iterator_string(it), bson_iterator_string_len(it) - 1));
                     }
                     break;
                 case BSON_NULL:
index bd5be3b..8e4ba2b 100644 (file)
@@ -2,6 +2,14 @@
 <configurationDescriptor version="84">
   <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
     <df name="node" root=".">
+      <df name="build">
+        <df name="Debug">
+          <df name="obj.target">
+            <df name="ejdb_native">
+            </df>
+          </df>
+        </df>
+      </df>
       <df name="nodejs">
         <df name="benchmark">
           <df name="arrays">
index 6f8c5ad..7739739 100644 (file)
@@ -32,7 +32,14 @@ module.exports.testSaveLoad = function(test) {
         test.equal(parrot1["_id"], oids[0]);
         test.ok(oids[1] == null);
         test.equal(parrot2["_id"], oids[2]);
-        test.done();
+
+        jb.load("parrots", parrot2["_id"], function(err, obj) {
+            test.ifError(err);
+            test.ok(obj);
+            test.equal(obj._id, parrot2["_id"]);
+            test.equal(obj.name, "Bounty");
+            test.done();
+        });
     });
 };