Description:
When trying to access a MongoDB collection that contains an array of primitive values using the find() method in Ballerina, I encountered a conversion error.
Affected Versions:
Ballerina 2201.10.1 (Swan Lake Update 10)
Error Occured:
Expected Output
Sample Code:
public type User record {|
readonly string id;
string name;
string email;
string[] subject_ids?;
string[] followers_ids?;
string[] following_ids?;
string[] requested_ids?;
string[] requested_by_ids?;
boolean is_deleted = false;
string role;
|};
resource function get users() returns models:User[]|error {
mongodb:Collection users = check self.db->getCollection("users");
stream<models:User, error?> resultStream = check users->find();
return check from User user in resultStream
select user;
}
Description: When trying to access a MongoDB collection that contains an array of primitive values using the
find()
method in Ballerina, I encountered a conversion error.Affected Versions: Ballerina 2201.10.1 (Swan Lake Update 10)
Error Occured:
Expected Output
Sample Code: