function testStore() { var ctx = context.new() var obj = store.upsert(ctx, "test", {"foo": "bar"}); var obj1 = store.get(ctx, "test", obj._id); console.log(obj, obj1); for (var key in obj) { if (!obj.hasOwnProperty(key)) { continue; } if (obj[key].toString() !== obj1[key].toString()) { throw new Error("obj['"+key+"'] !== obj1['"+key+"']"); } } var results = store.query(ctx, "test", { "eq": {"foo": "bar"} }, {"orderBy": "foo", "limit": 10, "skip": 0}); if (!results || results.length !== 1) { throw new Error("results should contains 1 item"); } store.delete(ctx, "test", obj._id); var obj2 = store.get(ctx, "test", obj._id); if (obj2 != null) { throw new Error("obj2 should be null"); } }