部署的应用程序,dpd.collection.first() 不工作
Deployd App, dpd.collection.first() not working
我已经在 Windows 7 64 位上安装了最新版本的 Deployd。一切正常,除了我无法查询单个对象。
也就是说,如果我使用下面的代码,
var query ={"name":"Jack","empid":"10"};
dpd.employees.first(query, function (result) {
console.log(result);
});
我在控制台 (Google Chrome) 收到指向函数 'first()' 的 TypeError: undefined is not a function。在仪表板的 API 选项卡上生成的所有其他功能都可以正常工作,没有任何问题。我已经尝试将 Deployd 重新安装到另一个目录,但问题仍然存在。还没有在不同的机器上试过。
可能是什么原因?
感谢任何帮助。
first() 函数已从 Deployd 的 dpd.js 中删除,但他们没有删除(忘记了吗?)仪表板生成的 API 调用代码。现在,我选择 select 使用 ID 属性 的单个对象,如下所示:
var q = {"id":"00000000000000"};
dpd.collection_name.get(q,function(result,error) {
if(error) return console.log(error);
console.log(result); //Result will have the object with the given ID
});
或者,如果ID 属性由于某种原因不可用,可以像往常一样使用字段名查询数据:
var q = {"empid":"10AE1",$limit:1}; //Limiting to 1 just to be sure
dpd.collection_name.get(q,function(result,error) {
if(error) return console.log(error);
console.log(result[0]); //result[0] will have the object with the given empid
});
如果有更好的解决方案,请告诉我!
我已经在 Windows 7 64 位上安装了最新版本的 Deployd。一切正常,除了我无法查询单个对象。
也就是说,如果我使用下面的代码,
var query ={"name":"Jack","empid":"10"};
dpd.employees.first(query, function (result) {
console.log(result);
});
我在控制台 (Google Chrome) 收到指向函数 'first()' 的 TypeError: undefined is not a function。在仪表板的 API 选项卡上生成的所有其他功能都可以正常工作,没有任何问题。我已经尝试将 Deployd 重新安装到另一个目录,但问题仍然存在。还没有在不同的机器上试过。
可能是什么原因?
感谢任何帮助。
first() 函数已从 Deployd 的 dpd.js 中删除,但他们没有删除(忘记了吗?)仪表板生成的 API 调用代码。现在,我选择 select 使用 ID 属性 的单个对象,如下所示:
var q = {"id":"00000000000000"};
dpd.collection_name.get(q,function(result,error) {
if(error) return console.log(error);
console.log(result); //Result will have the object with the given ID
});
或者,如果ID 属性由于某种原因不可用,可以像往常一样使用字段名查询数据:
var q = {"empid":"10AE1",$limit:1}; //Limiting to 1 just to be sure
dpd.collection_name.get(q,function(result,error) {
if(error) return console.log(error);
console.log(result[0]); //result[0] will have the object with the given empid
});
如果有更好的解决方案,请告诉我!