D
D
Dima nahkar2015-03-22 19:44:42
JavaScript
Dima nahkar, 2015-03-22 19:44:42

Why is data not being written to Mongolab?

Why is data not being written to Mongolab?
Connection successful no errors. Locally, everything works and the recording takes place in the local mongo, but mongolab cannot write the data, although there are no errors, the connection is established
var mongoose = require('mongoose');
mongoose.connect('mongodb://loginr:[email protected]:61558/bdname');
var schemaCat = mongoose.Schema({
name: String,
age: Number
});
var Cat = mongoose.model("Cat", schemaCat);
var kitty2 = new Cat({name: "c2", age: 22});
var kitty3 = new Cat({name: "c3", age: 33});
var kitty4 = new Cat({name: "c4", age: 44});
kitty2.save();
kitty3.save();
kitty4.save();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis1111, 2019-03-16
@Denis1111

const { Schema } = mongoose;
const schemaCat = new Schema({
   name: String,
   age: Number
});

const Cat = mongoose.model("Cat", schemaCat);

const kitty2 = new Cat({name: "c2", age: 22});
const kitty3 = new Cat({name: "c3", age: 33});
const kitty4 = new Cat({name: "c4", age: 44});

kitty2.save();
kitty3.save();
kitty4.save();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question