How to properly sort in Meteor for nested documents?

When doing something like this

Meteor.users.find({}, {
  sort: { 'profile.employeeId': 1}
});

I am getting the following error:

Key profile.employeeId must not contain '.'

As of now, I am using rawCollection() to be able to sort using nested documents (dot notation). What is the proper way of sorting in Meteor for nested documents?

1 Like