我在MongoLab上有一個數據庫。它有幾個集合。除一項工作外一個集合被稱爲「selectopts」。它有兩個文件。我可以清楚地看到這兩個文件。Mongo收集沒有.find方法
在我明確的代碼,我有...
var db = require('mongojs');
db.connect('mongodb://xxxx:[email protected]:53xxx/rednecks',['selectopts']);
exports.selects = function (req, res) {
db.selectopts.find(function (err, s) {
if (err) return;
res.json(s);
});
};
它總是錯誤的db.selectopts.find...
,類型錯誤:無法調用未定義方法「發現」。這個完全相同的愚蠢簡單的代碼適用於其他四個集合。爲什麼只有這一個集合不會從MongoLab中返回?
我如此徹底難倒。
編輯...
嘗試db.collection( 'selectopts')。找到(...和得到這個錯誤......再次
編輯..
以下是MongoLab中selectopts集合中的兩個文檔。您是否看到文檔有問題?...
編輯×3 ...
這是正確的/工作蒙戈連接設置代碼...
var mongojs = require('mongojs');
var db = mongojs.connect(
'xxx:[email protected]:53xxx/rednecks',
);
見的主要區別? (SMFH): - 使用/