I cannot get information from db.findOne() , everything is located, but I cannot extract values ​​from the query to external objects.

 var test; collection.findOne({name : name}, function (err, item){ console.log(item.name, item.value); test = item.value; }); 
  • What do you have in db? Did you choose a collection or db - is this a connection to MongoDB? - cheops
  • This is a collection. Incorrectly inserted here. Now I'll fix it. - Bedismo
  • If it is not difficult to add the contents of the find (). Limit (3) collection so that you can navigate the collection structure. - cheops
  • Frankly, it's difficult now. Half a day trying to figure out my head is tired. Here is the right of the collection {"name": "vodka", "value": 565, "date": {"$ wrap": "$ date", "v": 1463399211376, "h": "2016-05-16T11 : 46: 51.376Z "}," _ id ": {" $ wrap ":" $ oid "," v ": 2}," __ v ": 0} {" k ":" 0000000078 "," o o ":" 0000000139 "," v ":" 001 "} - Bedismo
  • In the console, inside the function, everything is displayed correctly. - Bedismo

0