Answer the question
In order to leave comments, you need to log in
How to use correctly?
Greetings!
Please tell me why the sli variable is not available when connecting to the database, I want to make records after receiving the promise. and going a little further, how can I then write an array like this in the base:
[
{ a : a} ,
]
service.get(current).then(sli => {
var date = new Date();
console.log(date);
console.log(sli[0]);
var MongoClient = require('mongodb').MongoClient, assert = require('assert');
var url = 'mongodb://localhost:27017/test';
// Use connect method to connect to the server
MongoClient.connect(url, function(err, db, sli) {
assert.equal(null, err);
console.log("Connected successfully to mongoserver");
console.log(sli);
db.close();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question