Access control is not enabled for the database'

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Windows 10, Core i5, 8 GB Ram
    • v3.4, v3.2

      I am creating an sample library app in nodejs+express+mongodb. when I run the gulp serve command the server start perfectly. when I goto specific mongodb page then it giving error insertMany is not a function.

      below is the page code:
      var express = require('express');
      var adminRouter = express.Router();
      var mongodb = require('mongodb').MongoClient;
      var books = [

      { title: 'India world', genre: 'Lorem Ipsum text changing occured', author: 'AbulKhair', read: false }

      ,

      { title: 'Make of the world', genre: 'Digital India towards', author: 'Jumanji', read: false }

      ];

      var router = function (nav) {
      adminRouter.route('/addBooks')
      .get(function (req, res) {
      var url = 'mongodb://127.0.0.1:27017/libraryAPP';
      mongodb.connect(url, function (err, db) {
      var collections = db.collections('books');
      collections.insertMany(books,
      function (err, results)

      { res.send(results); db.close(); }

      );
      });
      });

      return adminRouter;
      };

      module.exports = router;

        1. mongo cmd.jpg
          55 kB
          Abul Khair
        2. mongo insertmany.jpg
          133 kB
          Abul Khair

            Assignee:
            Unassigned
            Reporter:
            Abul Khair
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: