/**************************************************************************************************** * run */ function run() { spawn(function() { console.log("Testing getCollectionNames()"); var db = connect("mongodb://localhost:27017"); var names = db.getCollectionNames(); console.log(names); }); }
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var connect = require("./../lib/leafnode.js").connect; var spawn = require('fibers-utils').spawn; var mongodbUri = require("mongodb-uri"); var args = process.argv.slice(2); var uri = args[0]; spawn(function() { var uriObj = mongodbUri.parse(uri); var singleNodeConnection = uriObj.hosts.length==1; var options = { "db":{ }, "server": { "auto_reconnect": true } }; var db = connect(uri, options, singleNodeConnection); console.log(db.command({"isMaster":1})); });