const mongoose = require('mongoose'); mongoose .connect('mongodb://admin:[email protected]:27017/GIS?authSource=admin', { useUnifiedTopology: true, useNewUrlParser: true, }) .then(() => { console.log('连接成功'); }) .catch((e: any) => { console.log('连接错误:', e); }); const Schema = mongoose.Schema; const grid1080_1920 = new Schema({ _id: String, airport: String, camera_direction: String, point_data: Object, index_data: Object, gis_data: Object, camera_id: String, }); const Blog = mongoose.model('grid1080_1920', grid1080_1920); let a = () => { return new Promise(function (resolve, reject) { Blog.find().then((data: any) => { resolve(data); }); }); }; let sth = await a(); mongoose.connection.close(); ctx.body = sth;
标签:const,String,mongoose,1920,使用,data,Schema From: https://www.cnblogs.com/sexintercourse/p/17790740.html