Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Book = new Schema({
- ISBN: String,
- title: String,
- author: String,
- image: String,
- availability: [{zipcode: String,
- total: Number,
- loaned: Number
- }]
- });
- db.col.aggregate(
- [
- {$match:{$expr:{$gt:[{"$sum":"$availability.total"}, {"$sum":"$availability.loaned"}]}}},
- { $sample: { size: 25 } }
- ]
- )
Add Comment
Please, Sign In to add comment