Extract data from mongo collection using aggregation ( $project )

22 views
Skip to first unread message

Nezar Oussama

unread,
Sep 13, 2023, 9:36:30 AM9/13/23
to CDAP User
Hello,
I've created pipeline who extracts data from Mongo (source) then write the result in big query sink.
In mongodb query I'm using this query: {"$project": {"_id": 1, "alfa_id2": "$alfa_id"}}
Include _id and rename alfa_id to alfa_id2 I'm getting this error: unknown operator: $project, I've tried multiple syntaxes like:

``[{"$project": {"_id": 1, "alfa_id2": "$alfa_id"}}] error : unknown operator: $project

[ { "_id": 1, "alfa_id2": "$alfa_id" } ] no error but i have nothing in output 0 rows.

{ "_id": 1, "alfa_id2": "$alfa_id" } no error but i have nothing in output 0 rows.

db.getCollection('alfa').aggregate([{$project: {'_id': 1,'alfa_id2': '$alfa_id'}}]) error can't use db.getCollection('alfa') ...`` and others


Anyone who  has had this type of problem ? Is there another way to use aggregation in mongodb source query pls?


Thank you !

Vitalii Tymchyshyn

unread,
Oct 24, 2023, 12:57:53 PM10/24/23
to CDAP User
CDAP uses Mongo Hadoop support to read big data from MongoDB.
To add to that, it's usually tricky to support aggregations in big data as aggregations require preprocessing and thus are often not splittable for big data processing.

Best regards, Vitalii Tymchyshyn

Reply all
Reply to author
Forward
0 new messages