async get (sid) { try { let doc = await this.coll.findOne({ sid: sid }) return doc ? doc.session : undefined } catch (e) { log(e.message) } }
module.exports.client .db('jschan') .collection('version') .findOne({ '_id': 'version' }) .then(res => res.version)
app.get('/', async function (req, res) { MongoClient.connect(url, function (err, client) { if (err) throw err; let database = client.db(db); database.collection(collection).findOne().then(function (result) { if (result) { res.json(result); } }) }); });
/* Signups */ async getSignup(param){ if (!param.season){ param.season = "season 15"; } return await this.signups.findOne(param); }
/* Standings */ async getStanding(param,options){ return await this.standings.findOne(param,options); }
app.get('update/:id', function(request, response) { people.findOne({ _id: new mongo.ObjectID(request.params.id) }, function(err, doc) { if(err) throw err; response.render("update.jade", { person: doc}); }); });
async function initializeDB() { const db = await connectDB(); const user = await db.collection('users').findOne({ id: 'U1' }); if (user) { return; } for (let collectionName in defaultState) { let collection = db.collection(collectionName); await collection.insertMany(defaultState[collectionName]); } }
/* Clans */ async getClan(param){ return await this.clans.findOne(param); }
/** * ドキュメントを検索して1つの項目を取得します * * @param {String} collectionName * @param {Object} query * @param {Object} options * @return {Promise<any>} */ find(collectionName, query, options) { if (collectionName == null || query == null) { throw new MissingArgumentsError(); } return this._db.collection(collectionName).findOne(query, options); }
/* Divisions */ async getDraft(param) { return await this.drafts.findOne(param); }
async getMatchDate(param){ return await this.matchDates.findOne(param); }
async getPlayer(param){ return await this.players.findOne(param); }
/* Races */ async getRace(param){ return await this.races.findOne(param); }
/* Trophies */ async getTrophy(filter){ return await this.trophies.findOne(filter); }
async get (sid) { try { let doc = await this.coll.findOne({ sid: sid }) return doc ? doc.session : undefined } catch (e) { log(e.message) } }