I have documents like these :
Merchant:
{
"_id" : ObjectId("628728cf9f5c99d8dedbe759"),
"name" : "agriTales",
"information" : "Farmers social",
"categories" : [
ObjectId("6287220c52497922d6f4a121")
],
"website" : "www.agritales.com",
"active" : true
}
LuckyDraw:
{
"_id" : ObjectId("62873487e0e5eedc24748a55"),
"business" : ObjectId("628728cf9f5c99d8dedbe759"),
"title" : "May Lucky draw 2022",
"date_start" : ISODate("2022-04-26T00:00:00Z"),
"max_participants" : 5,
"active" : true,
"date_of_draw" : ISODate("2022-07-30T00:00:00Z"),
"prizes_winners" : [
{
"prize_name" : "1st Prize",
"coupon_voucher" : ObjectId("62872f809f5c99d8dedbe764")
},
{
"prize_name" : "2nd Prize",
"coupon_voucher" : ObjectId("62872f8d9f5c99d8dedbe765")
}
],
"result_declared" : true
}
CouponVoucher:
{
"_id" : ObjectId("62872f809f5c99d8dedbe764"),
"business" : ObjectId("628728cf9f5c99d8dedbe759"),
"type" : "voucher",
"title" : "8farmers Coupons 2001",
"minimum_order_value" : 0,
"voucher_face_value" : 2001,
"active" : true,
"status" : "NEW",
"date_expiry" : ISODate("2022-12-31T00:00:00Z"),
}
{
"_id" : ObjectId("62872f8d9f5c99d8dedbe765")
"type" : "voucher",
"title" : "8farmers Coupons 1501",
"minimum_order_value" : 0,
"voucher_face_value" : 1501,
"active" : true,
"status" : "NEW",
"date_expiry" : ISODate("2022-12-31T00:00:00Z")
}
class LuckyDraws(Document):
business = ReferenceField(Merchants, required=True)
branches = ListField(ReferenceField(MerchantBranches))
title = StringField(required=True)
date_start = DateTimeField(required=True) # the date when luck draw will be available to participate
max_participants = IntField() # max number of participants
active = BooleanField(default=True)
date_of_draw = DateTimeField(required=True) # the date when luck draw will be declared
filter_conditions = EmbeddedDocumentField(LuckyDrawFilterConditions)
participants = ListField(ReferenceField(Users), required=False)
prizes_winners = ListField(EmbeddedDocumentField(LuckyDrawPrizesWinners), required=True)
class LuckyDrawPrizesWinners(EmbeddedDocument):
prize_name = StringField(required=True)
coupon_voucher = ReferenceField(CouponVoucher, required=True)
winner = ReferenceField(Users, blank=True, null=True, default=None)
class CouponVoucher(Document):
business = ReferenceField(Merchants, required=True)
title = StringField(required=True, unique=True)
discount_type = StringField(required=False) # amount / percentage
coupon_discount = DecimalField(required=False)
max_count = IntField(required=False)
minimum_order_value = DecimalField(required=False)
I am looking for a result where I get details of the lucky draw and its corresponding prizes and couponvoucher details
used below pipeline
LuckyDraws.objects.aggregate([{
'$lookup':
{
"from": "merchants",
"localField": "business",
"foreignField": "_id",
"as": "business",
"pipeline": [
{"$project": {"name": 1, "information": 1, "categories": 1}}
]
}
},
{"$project":
{
"business": 1, "title": 1, "date_start": 1, "active": 1, "date_of_draw": 1,
"prizes_winners.prize_name": 1, "prizes_winners.coupon_voucher": 1,
"result_declared": 1, "vouchers": 1
}
},
{
'$lookup':
{
"from": "coupon_voucher",
"localField": "prizes_winners.coupon_voucher",
"foreignField": "_id",
"pipeline": [
{"$project": {"title": 1, "minimum_order_value": 1, "voucher_face_value": 1,
"active": 1, "date_expiry": 1}}
],
"as": "prizes_winners"
}
},
{
"$sort": {
"date_of_draw": -1
}
}
]
and getting below results but its missing prize_name under prizes_winners, please let me know what I am missing and how t oadd prize_name under prizes_winners.
the result i am getting :
[
{
"_id": {
"$oid": "62873487e0e5eedc24748a55"
},
"business": [
{
"_id": {
"$oid": "628728cf9f5c99d8dedbe759"
},
"name": "agriTales",
"information": "Farmers social",
"categories": [
{
"$oid": "6287220c52497922d6f4a121"
}
]
}
],
"title": "May Lucky draw 2022",
"date_start": {
"$date": "2022-04-26T00:00:00Z"
},
"active": true,
"date_of_draw": {
"$date": "2022-07-30T00:00:00Z"
},
"prizes_winners": [
{
"_id": {
"$oid": "62872f809f5c99d8dedbe764"
},
"title": "8farmers Coupons 2001",
"minimum_order_value": 0.0,
"voucher_face_value": 2001.0,
"active": true,
"date_expiry": {
"$date": "2022-12-31T00:00:00Z"
}
},
{
"_id": {
"$oid": "62872f8d9f5c99d8dedbe765"
},
"title": "8farmers Coupons 1501",
"minimum_order_value": 0.0,
"voucher_face_value": 1501.0,
"active": true,
"date_expiry": {
"$date": "2022-12-31T00:00:00Z"
}
}
],
"result_declared": true
}
]
I want the result should be :
[
{
"_id": {
"$oid": "62873487e0e5eedc24748a55"
},
"business": [
{
"_id": {
"$oid": "628728cf9f5c99d8dedbe759"
},
"name": "agriTales",
"information": "Farmers social",
"categories": [
{
"$oid": "6287220c52497922d6f4a121"
}
]
}
],
"title": "May Lucky draw 2022",
"date_start": {
"$date": "2022-04-26T00:00:00Z"
},
"active": true,
"date_of_draw": {
"$date": "2022-07-30T00:00:00Z"
},
"prizes_winners": [
{
**"prize_name":"1st prize",**
"_id": {
"$oid": "62872f809f5c99d8dedbe764"
},
"title": "8farmers Coupons 2001",
"minimum_order_value": 0.0,
"voucher_face_value": 2001.0,
"active": true,
"date_expiry": {
"$date": "2022-12-31T00:00:00Z"
}
},
{
**"prize_name":"2nd prize",**
"_id": {
"$oid": "62872f8d9f5c99d8dedbe765"
},
"title": "8farmers Coupons 1501",
"minimum_order_value": 0.0,
"voucher_face_value": 1501.0,
"active": true,
"date_expiry": {
"$date": "2022-12-31T00:00:00Z"
}
}
],
"result_declared": true
}
]
There are lots of ways, and possibly more efficient ways, to do this. Here's one way.
db.LuckyDraw.aggregate([
{
"$lookup": {
"from": "Merchant",
"localField": "business",
"foreignField": "_id",
"pipeline": [ { "$unset": [ "active", "website" ] } ],
"as": "business"
}
},
{
"$lookup": {
"from": "CouponVoucher",
"localField": "prizes_winners.coupon_voucher",
"foreignField": "_id",
"let": { "prizes_winners": "$prizes_winners" },
"pipeline": [
{
"$set": {
"prize_name": {
"$reduce": {
"input": "$$prizes_winners",
"initialValue": "",
"in": {
"$cond": [
{ "$eq": [ "$$this.coupon_voucher", "$_id" ] },
"$$this.prize_name",
"$$value"
]
}
}
}
}
}
],
"as": "prizes_winners"
}
}
])
Try it on mongoplayground.net.
Related
return the order with the user where purchase id: 123, product id: p123 and user and order shipping.mode =2
db={
"orders": [
{
"_id": ObjectId("62155381877d4300196008ef"),
"shipping": {
"mode": 1
},
"products": [],
"user": ObjectId("6186bd3315a342001bd84f42"),
},
{
"_id": ObjectId("6215569b54cc7f0030c44e0f"),
"shipping": {
"mode": 2
},
"user": ObjectId("6186bd3315a342001bd84f43"),
"products": [
{
"id": "p123"
}
],
}
],
"users": [
{
"_id": ObjectId("6186bd3315a342001bd84f43"),
"shipping": {
"mode": 2
},
"name": "user100",
"purchase": [
{
"id": "123"
},
{
"id": "hjhh"
}
],
}
]
}
https://mongoplayground.net/p/IomR8U7Ard-
db.orders.aggregate([
{
"$lookup": {
"from": "users",
"localField": "user",
"foreignField": "_id",
"as": "user"
}
},
{
"$unwind": "$user"
},
{
"$unwind": "$user.purchase"
},
{
"$match": {
"$and": [
{
"shipping.mode": {
"$gt": 0
}
},
]
}
},
{
"$match": {
"$or": [
{
"$and": [
{
"user.shipping.mode": {
"$eq": 2
}
},
{
"user.purchase.id": {
"$eq": "123"
}
},
{
"$expr": {
"$in": [
"p123",
"$products.id"
]
}
}
]
},
]
}
},
])
I have two collections, 1. temporaryCollection, 2. permanentCollection, I would like to take data from temporaryCollection and update in permanentCollection. To see the expected result see updatedPermanentCollection below.
Fields that are taken from Temporary collection and updated in Permanent collection are:
emailAddresses
phoneNumbers
ContactName
ContactNumber
For your info, the fields that are changed in Temporary collection
contacts[0]['emailAddresses']
contacts[0]['ContactName']
contacts[0]["phoneNumbers"]
contacts[0]["ContactNumber"]
Field that are that should not be changed after updation in UpdatedPermanentCollection is
contacts._id
Note: contacts is an Array of objects, for simplicity I have shown just one object.
I am currently using the below query which updates the permanentCollection but also overrides the contacts._id field. I don't want the contacts._id field to be overridden.
Here is my MongoDB Query
db.temporaryCollection.aggregate([
{
$match: {
userID: ObjectId("61d1efea2c0fab00340f47c8"),
},
},
{
$merge: {
into: "permanentCollection",
on: "userID",
whenMatched: "merge",
whenNotMatched: "insert",
},
},
]);
1. temporaryCollection
{
"_id": { "$oid": "61d1f04266289f003452d705" },
"userID": { "$oid": "61d1efea2c0fab00340f47c8" },
"contacts": [
{
"emailAddresses": [
{ "id": "6884", "label": "email1", "email": "addedemail#gmail.com" }
],
"phoneNumbers": [
{
"label": "other",
"id": "4594",
"number": "+918984292930"
},
{
"label": "other",
"id": "4595",
"number": "+911234567890"
}
],
"_id": { "$oid": "61d1f04266289f003452d744" },
"ContactName": "Sample User 1 Name Changed",
"ContactNumber": "+918984292930",
"recordID": "833"
}
],
"userNumber": "+911234567890",
"__v": 7
}
2. permanentCollection
{
"_id": { "$oid": "61d1f04266289f003452d701" },
"userID": { "$oid": "61d1efea2c0fab00340f47c8" },
"contacts": [
{
"emailAddresses": [],
"phoneNumbers": [
{
"label": "other",
"id": "4594",
"number": "+918984292929"
},
{
"label": "other",
"id": "4595",
"number": "+911234567890"
}
],
"_id": { "$oid": "61d1f04266289f003452d722" },
"ContactName": "Sample User 1",
"ContactNumber": "+918984292929",
"recordID": "833"
}
],
"userNumber": "+911234567890",
"__v": 7
}
3. updatedPermanentCollection (Expected result)
{
"_id": { "$oid": "61d1f04266289f003452d701" },
"userID": { "$oid": "61d1efea2c0fab00340f47c8" },
"contacts": [
{
"emailAddresses": [
{ "id": "6884", "label": "email1", "email": "addedemail#gmail.com" }
],
"phoneNumbers": [
{
"label": "other",
"id": "4594",
"number": "+918984292930"
},
{
"label": "other",
"id": "4595",
"number": "+911234567890"
}
],
"_id": { "$oid": "61d1f04266289f003452d722" },
"ContactName": "Sample User 1 Name Changed",
"ContactNumber": "+918984292930",
"recordID": "833"
}
],
"userNumber": "+911234567890",
"__v": 7
}
Try with this aggregation query.
db.temporarCollection.aggreagate(
[
{
"$lookup": {
"from": "permanantCollection",
"let": {
"user_id": "$userID"
},
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$$user_id", "$userID"
]
}
}
}
],
"as": "pcontacts"
}
}, {
"$unwind": {
"path": "$pcontacts",
"preserveNullAndEmptyArrays": true
}
}, {
"$project": {
"contacts": {
"$map": {
"input": "$contacts",
"as": "contact",
"in": {
"tcontact": "$$contact",
"pcontact": {
"$first": {
"$filter": {
"input": "$pcontacts.contacts",
"as": "pcontact",
"cond": {
"$eq": [
"$$pcontact.recordID", "$$contact.recordID"
]
}
}
}
}
}
}
},
"userNumber": 1,
"userID": 1,
"_id": 0
}
}, {
"$project": {
"contacts": {
"$map": {
"input": "$contacts",
"as": "contact",
"in": {
"emailAddresses": "$$contact.tcontact.emailAddresses",
"phoneNumbers": "$$contact.tcontact.phoneNumbers",
"ContactName": "$$contact.tcontact.ContactName",
"ContactNumber": "$$contact.tcontact.ContactNumber",
"recordID": {
"$let": {
"vars": {},
"in": {
"$cond": {
"if": "$$contact.pcontact.recordID",
"then": "$$contact.pcontact.recordID",
"else": "$$contact.tcontact.recordID"
}
}
}
},
"_id": {
"$let": {
"vars": {},
"in": {
"$cond": {
"if": "$$contact.pcontact._id",
"then": "$$contact.pcontact._id",
"else": "$$contact.tcontact._id"
}
}
}
}
}
}
},
"userNumber": 1,
"userID": 1
}
}, {
"$merge": {
"into": "pc",
"on": "userID",
"whenMatched": "replace",
"whenNotMatched": "insert"
}
}
])
It is not a fully optimized query but it works.
Try to add $unset to db query.
db.temporaryCollection.aggregate([
{
$unset: "_id"
},
{
$match: {
userID: ObjectId("61d1efea2c0fab00340f47c8"),
},
},
{
$merge: {
into: "permanentCollection",
on: "userID",
whenMatched: "merge",
whenNotMatched: "insert",
},
},
]);
I have got two collections, chapters and courses with one-to-one association,
db={
"chapters": [
{
"_id": 10,
"course_id": 1,
"author": "John"
},
{
"_id": 20,
"course_id": 2,
"author": "John"
},
{
"_id": 30,
"course_id": 3,
"author": "Timmy"
},
{
"_id": 40,
"course_id": 4,
"author": "John"
},
],
"courses": [
{
"_id": 1,
"published": true,
"name": "course 1"
},
{
"_id": 2,
"published": false,
"name": "course 2"
},
{
"_id": 3,
"published": true,
"name": "course 3"
},
{
"_id": 4,
"published": true,
"name": "course 4"
}
]
}
How do I query all chapters with the published course (published=true) and the author is "John"?
You can use $match, $lookup then $group by author then simply $filter it based on published
db.chapters.aggregate([
{
$match: {
author: "John"
}
},
{
"$lookup": {
"from": "courses",
"localField": "course_id",
"foreignField": "_id",
"as": "course"
}
},
{
$project: {
_id: 1,
course: {
$first: "$course"
},
author: 1
}
},
{
$group: {
_id: "$author",
courseChapters: {
$push: "$$ROOT"
}
}
},
{
$project: {
courseChapters: {
$filter: {
input: "$courseChapters",
as: "cc",
cond: {
$eq: [
"$$cc.course.published",
true
]
}
}
}
}
}
])
Output
[
{
"_id": "John",
"courseChapters": [
{
"_id": 10,
"author": "John",
"course": {
"_id": 1,
"name": "course 1",
"published": true
}
},
{
"_id": 40,
"author": "John",
"course": {
"_id": 4,
"name": "course 4",
"published": true
}
}
]
}
]
Mongoplayground: https://mongoplayground.net/p/x-XghXzZUk4
How to populate in result of aggregated query in monogdb
Array of followedId
var followeduserId = ["abc","efg","xyz","pqr","acd","rts"];
Feeds Recommended
[
{
"feedsId": "feed1",
"userId": "abc"
},
{
"feedsId": "feed1",
"userId": "efg"
}
]
Feeds collection
[
{
"link": "www.yodo.com",
"recommended": [
"abc",
"efg"
],
"title": "This is my feed7",
"topics": [
"topi1",
"topi2",
"topi3",
"topi4"
]
},
{
"link": "www.yodo.com",
"recommended": [
"abc",
"efg",
"das",
"asd",
"eqw",
"weq"
],
"title": "This is my feed8",
"topics": [
"topi1",
"topi2",
"topi3",
"topi4"
]
}
]
Ran aggregation query
feedsrecommended.aggregate([
{ $match: { userId: { $in: "followersId" }}},
{ $lookup: {
from: "feeds",
localField: "feedsId",
foreignField: "_id",
as: "feedsId"
}},
{ $group: {
"_id": { "feedsId": "$feedsId" },
"count": { "$sum": 1 }
}},
{ $sort: { count: -1 }}
])
result After aggregation
var resultfeeds = [
{
"count": 7,
"id": {
"_id": "feed1",
"link": "www.yodo.com",
"recommended": [
"abc",
"efg",
"xyz",
"pqr",
"acd",
"rts"
],
"title": "This is my feed1",
"topics": [
"topi1",
"topi8",
"topi6",
"topi5"
]
}
},
{
"count": 3,
"id": {
"_id": "feed5",
"link": "www.yodo.com",
"recommended": [
"abc",
"efg",
"acd",
"rts"
],
"title": "This is my feed1",
"topics": [
"topi1",
"topi2",
"topi3",
"topi4"
]
}
},
{
"count": 3,
"id": {
"_id": "feed6",
"link": "www.yodo.com",
"recommended": [
"abc",
"efg",
"xyz",
"pqr"
],
"title": "This is my feed1",
"topics": [
"topi7",
"topi1",
"topi4",
"topi8"
]
}
},
{
"count": 2,
"id": {
"_id": "feed2",
"link": "www.yodo.com",
"recommended": [
"abc",
"acd",
"rts"
],
"title": "This is my feed1",
"topics": [
"topi7",
"topi6",
"topi8"
]
}
},
{
"count": 2,
"id": {
"_id": "feed7",
"link": "www.yodo.com",
"recommended": [
"abc",
"efg"
],
"title": "This is my feed1",
"topics": [
"topi1",
"topi5",
"topi6",
"topi4"
]
}
},
{
"count": 1,
"id": {
"_id": "feed3",
"link": "www.yodo.com",
"recommended": [
"abc",
"asd",
"eqw",
"weq"
],
"title": "This is my feed1",
"topics": [
"topi1",
"topi7",
"topi6",
"topi4"
]
}
},
{
"count": 1,
"id": {
"_id": "feed8",
"link": "www.yodo.com",
"recommended": [
"abc",
"das",
"asd",
"eqw",
"weq"
],
"title": "This is my feed1",
"topics": [
"topi1",
"topi2",
"topi5",
"topi4"
]
}
}
]
I want to populate topics and recommeded userName and image in the result
topic collection
[
{
"topic_name": "tiger"
},
{
"topic_name": "loin"
}
]
user collection
[
{
"name": "deepa",
"profileImg": "www.com/facebook.jpg"
},
{
"name": "nisa",
"profileImg": "www.com/facebook.jpg"
}
]
My last result should be like this
[
{
"count": 2,
"id": {
"_id": "feed2",
"link": "www.yodo.com",
"recommended": [
{
"_id": "abc",
"name": "deepa",
"profileImg": "www.com/facebook.jpg"
},
{
"_id": "acd",
"name": "sigger",
"profileImg": "www.com/facebook.jpg"
},
{
"_id": "rts",
"name": "buster",
"profileImg": "www.com/facebook.jpg"
}
],
"title": "This is my feed1",
"topics": [
{
"_id": "topi6",
"topic_name": "boolena"
},
{
"_id": "topi7",
"topic_name": "mika"
},
{
"_id": "topi8",
"topic_name": "tika"
}
]
}
}
]
You can try below aggregation in mongodb 3.6 and above
Feedsrecommended.aggregate([
{ "$match": { "userId":{ "$in": followersId }}},
{ "$group": {
"_id": "$feedsId",
"count": { "$sum": 1 }
}},
{ "$lookup": {
"from": "feeds",
"let": { "feedsId": "$_id" },
"pipeline": [
{ "$match": { "$expr": { "$eq": [ "$_id", "$$feedsId" ] }}},
{ "$lookup": {
"from": "topics",
"let": { "topics": "$topics" },
"pipeline": [
{ "$match": { "$expr": { "$in": [ "$_id", "$$topics" ] } } }
],
"as": "topics"
}},
{ "$lookup": {
"from": "users",
"let": { "recommended": "$recommended" },
"pipeline": [
{ "$match": { "$expr": { "$in": [ "$_id", "$$recommended" ] } } }
],
"as": "recommended"
}}
],
"as": "feedsId"
}}
])
I have the following result. Below it would be possible to make a map joining the array each with its objectid.
{
"_id": ObjectId("597233b50e717e0585dbd94a"),
"createdAt": ISODate("2017-07-21T17:02:45.119+0000"),
"name": "cardoso",
"gender": "female",
"profile": [{
"profession": "master",
"_id": ObjectId("597233b50e717e0585dbd94b"),
"departament": ObjectId("597233b50e717e0585dbd94e")
},
{
"_id": ObjectId("59766719003e7d552fe40e8c"),
"profession": "master",
"departament": ObjectId("59766719003e7d552fe40e8b")
},
{
"_id": ObjectId("5976b8f99d8a4326c6bf1ae5"),
"profession": "master",
"departament": ObjectId("5974d8fe398e5b2fd433410f")
}
],
"Institution": {
"_id": ObjectId("597233b50e717e0585dbd94c"),
"cnpj": 64837134000144.0,
"deletedAt": false,
"departament": [{
"title": "cardoso",
"category": "Sub-17",
"_id": ObjectId("597233b50e717e0585dbd94e")
},
{
"sport": "Tênis",
"title": "novo",
"category": "Sub-12",
"_id": ObjectId("59766719003e7d552fe40e8b")
},
{
"_id": ObjectId("5974d8fe398e5b2fd433410f"),
"category": "Intercâmbio",
"title": "testeJJJ",
"sport": "natação"
}
]
}
}
I need to do the following result. I did not want to have to manipulate the result in the node.
{
"sport": "Tênis",
"profession": "master",
"title": "novo",
"category": "Sub-12",
"_id": ObjectId("59766719003e7d552fe40e8b")
}
I already tended to do something but the query ends up getting very big
The basic premise here is to "lookup" the content in the other array whilst processing via $map.
This is either done via $indexOfArray with MongoDB 3.4:
db.collection.aggregate([
{ "$addFields": {
"Institution": {
"departament": {
"$map": {
"input": "$Institution.departament",
"as": "d",
"in": {
"sport": "$$d.title",
"profession": {
"$arrayElemAt": [
"$profile.profession",
{ "$indexOfArray": [ "$profile.departament", "$$d._id" ] }
]
},
"title": "$$d.title",
"category": "$$d.category"
}
}
}
}
}}
])
In that first index we look for the "index position" from the "profile" array that matches the current value of _id on the specified field. Then extract the data at that index via $arrayElemAt.
Or using $filter and the $arrayElemAt "the other way around" with MongoDB 3.2:
db.collection.aggregate([
{ "$addFields": {
"Institution": {
"departament": {
"$map": {
"input": "$Institution.departament",
"as": "d",
"in": {
"sport": "$$d.title",
"profession": {
"$arrayElemAt": [
{ "$map": {
"input": {
"$filter": {
"input": "$profile",
"as": "p",
"cond": { "$eq": [ "$$p.departament", "$$d._id" ] }
}
},
"as": "p",
"in": "$$p.profession"
}},
0
]
},
"title": "$$d.title",
"category": "$$d.category"
}
}
}
}
}}
])
In which case the $filter reduces the array content in "profile" down to only matching elements, which should be just one. This is then extracted at the 0 index by $arrayElemAt.
Same result in either case:
{
"_id" : ObjectId("597233b50e717e0585dbd94a"),
"createdAt" : ISODate("2017-07-21T17:02:45.119Z"),
"name" : "cardoso",
"gender" : "female",
"profile" : [
{
"profession" : "master",
"_id" : ObjectId("597233b50e717e0585dbd94b"),
"departament" : ObjectId("597233b50e717e0585dbd94e")
},
{
"_id" : ObjectId("59766719003e7d552fe40e8c"),
"profession" : "master",
"departament" : ObjectId("59766719003e7d552fe40e8b")
},
{
"_id" : ObjectId("5976b8f99d8a4326c6bf1ae5"),
"profession" : "master",
"departament" : ObjectId("5974d8fe398e5b2fd433410f")
}
],
"Institution" : {
"_id" : ObjectId("597233b50e717e0585dbd94c"),
"cnpj" : 64837134000144.0,
"deletedAt" : false,
"departament" : [
{
"sport" : "cardoso",
"profession" : "master",
"title" : "cardoso",
"category" : "Sub-17"
},
{
"sport" : "novo",
"profession" : "master",
"title" : "novo",
"category" : "Sub-12"
},
{
"sport" : "testeJJJ",
"profession" : "master",
"title" : "testeJJJ",
"category" : "Intercâmbio"
}
]
}
}