- Added TablesList page
- Added Insert Record empty
This commit is contained in:
@@ -4,6 +4,8 @@ const Schema = mongoose.Schema;
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
@@ -13,7 +15,7 @@ mongoose.plugin(schema => {
|
||||
|
||||
const bookingSchema = new Schema({
|
||||
idapp: {
|
||||
type: Number,
|
||||
type: String,
|
||||
},
|
||||
userId: {
|
||||
type: String,
|
||||
@@ -104,34 +106,6 @@ bookingSchema.statics.findAllDistinctByBooking = function (idapp) {
|
||||
};
|
||||
|
||||
|
||||
function getQueryBookingUser(filterMatchBefore = {}, userId) {
|
||||
|
||||
let filterMatchAfter = {
|
||||
$or: getQueryFilterTodo(userId)
|
||||
};
|
||||
|
||||
let myobjField = getobjFieldTodo(true);
|
||||
|
||||
const query = [
|
||||
{ $match: filterMatchBefore },
|
||||
{
|
||||
$lookup: {
|
||||
from: "users",
|
||||
localField: "userId", // field in my collection
|
||||
foreignField: "_id", // field in the 'from' collection
|
||||
as: "fromItems"
|
||||
}
|
||||
},
|
||||
{
|
||||
$replaceRoot: { newRoot: { $mergeObjects: [{ $arrayElemAt: ["$fromItems", 0] }, "$$ROOT"] } }
|
||||
},
|
||||
{ $match: filterMatchAfter },
|
||||
{ $project: myobjField }];
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
var Booking = mongoose.model('Booking', bookingSchema);
|
||||
const Booking = mongoose.model('Booking', bookingSchema);
|
||||
|
||||
module.exports = { Booking };
|
||||
|
||||
Reference in New Issue
Block a user