MongleDB

安裝 Server 端 app

安裝Client端

Usage: 1: install Dory mongoDB Server 2: run your Server 3: use termux node.js 4: run this code in your js file

Code:

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test', { useMongoClient: true });
mongoose.Promise = global.Promise;

var Cat = mongoose.model('Cat', { name: String });

var kitty = new Cat({ name: 'Zildjian' });
kitty.save(function (err) {
  if (err) {
    console.log(err);
  } else {
    console.log('meow');
  }
});

Last updated