Answer the question
In order to leave comments, you need to log in
Print all values from Mongoose base?
var userScheme = new Schema({
name: String,
age: Number
});
var User = mongoose.model("User", userScheme);
var user = new User({
name: "Bill",
age: 41
});
user.save(function(err){
mongoose.disconnect(); // отключение от базы данных
if(err) return console.log(err);
console.log("Сохранен объект", user);
});
Answer the question
In order to leave comments, you need to log in
Yes. Just before db.users.find(), you will need to select the database use "database name". The name of the database is specified in mongoose.connect() ( in the first parameter where is the string with the mongo url ). View all available databases in show databases mong
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question