Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getCinemaInfo.then( function(data) {
- cine.push(data);
- });
- function getCinemaInfo()
- {
- return new Promise(function (resolve, reject) {
- MongoClient.connect(url, function (err, client) {
- console.log("Connected successfully to server");
- const db = client.db('cineitaly');
- db.collection('cinemas').find({name: item.cinema.trim()}).toArray(function (err, result) {
- if (result[0] === "undefined" || result[0] === "") {
- result[0] = [];
- }
- //console.log(result[0]);
- // res.status(200).json({cinemas:result[0]});
- if (typeof result[0] === 'undefined') {
- console.log("empty array");
- }
- else {
- c = {
- "name": item.cinema,
- "address": result[0].address,
- "number": result[0].number,
- "site": result[0].site,
- "timeStart": item.programmingTime,
- "image": result[0].image,
- "latitude": result[0].latitude,
- "longitude": result[0].longitude
- };
- }
- });
- client.close();
- });
- resolve(c);
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement