SELECT
DEPTMST.DEPTID,
DEPTMST.DEPTNAME,
DEPTMST.CREATEDT,
COUNT(USRMST.UID)
FROM DEPTMASTER DEPTMST
INNER JOIN USERMASTER USRMST ON USRMST.DEPTID=DEPTMST.DEPTID
WHERE DEPTMST.CUSTID=1000 AND DEPTMST.STATUS='ACT
我试
从每小时返回一条记录的MongoDB聚合中,我还需要知道字段中的“模式”或最常见的值。
到目前为止,我已经在两个日期之间选择了一组记录,并且每小时返回一条记录,包括一个字段值的平均值。但我也需要最常见的类别,其中类别数字段包含1、2、3或4。
var myName = "CollectionName"
//schema for mongoose
var mySchema = new Schema({
dt: Date,
value: Number,
category: Number
});
var myDB = mongoose.createConne
我在我的mongoose代码中创建了两个不同的模式。
//News Schema
var newsSchema = mongoose.Schema({
link: { type: String, index: {unique: true, dropDups: true}, required: 'Kindly enter the link of the news' },
description: { type: String, required: 'Kindly enter the description of the news
基本上,我试着在一个使用Node.js和Mongoose的小应用程序中,根据特定电影标题的评论,从5项中找出平均评分。
电影模式:
var mongoose = require("mongoose");
//SCHEMA SET UP
var movieSchema = new mongoose.Schema({
title: String,
director: String,
year: Number,
comments:[
{
type: mongoose.Schema.Types.ObjectId,