Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.getJoinedTransactions = function(firmId, page, pageSize, billerId, matterId, words, billingStatus, cb) {
- let firmIdToObjId = new mongoose.Types.ObjectId(global.user.firmId);
- let query = { firmId: firmIdToObjId };
- if ( typeof billerId === "object" ) {
- billerId = new mongoose.Types.ObjectId(billerId);
- query.contactId = billerId;
- }
- if ( typeof matterId === "object" ) {
- matterId = new mongoose.Types.ObjectId(matterId);
- query.matterId = matterId;
- }
- ....
- myAggregate = [
- { $sort: { date: -1 } },
- {
- $match: query
- },
- ....
- Transactions.aggregate(myAggregate).exec( function(err, transactions) {
- if (err) {
- console.log(err);
- }
- someVar = transactions.length;
- ....
- if (typeof billingStatus === "string" && billingStatus != "") {
- if (billingStatus === "billed") {
- query.billId = { $not: null } ; <-- This does not work.
- } else if (billingStatus === "unbilled") {
- query.billId = null; <-- This works!
- }
- }
Add Comment
Please, Sign In to add comment