With the following code I get a correct count of items (cursor.count) but it reverts to 0 at the final log. However, no actual documents seems to ever be returned (cursor.fetch). It does work if I only have one field that is an array or if I only have the four “addresses” fields that are arrays.
ContactsIndex = new EasySearch.Index({
collection: Contacts,
fields: [
"prefix",
"first",
"middle",
"last",
"suffix",
"phonetic_first",
"phonetic_middle",
"phonetic_last",
"nickname",
"job_title",
"department",
"company",
"maiden",
"phones.phone",
"emails.email",
"urls.url",
"dates.date_entry",
"relateds.related",
"immps.user_name",
"addresses.street",
"addresses.city",
"addresses.state",
"addresses.postal_code"
],
engine: new EasySearch.MongoDB()
})
Tracker.autorun(function () {
cursor = ContactsIndex.search('Marie');
console.log(cursor.fetch());
console.log(cursor.count());
});