I created a scheme using Aldeed node-simpl-schema
and attached it to a collection that I populated with almost 40.000 entries parse from a JSON database
using the following command:mongoimport -h localhost:3001 --db meteor --collection myCollection --type json --file myFile.json --jsonArray
. The import worked well I can query the database from the console (meteor mongo
). I can also present the database to the client using Aldeed tabular package
. But for some reasons I can’t fetch the data from another collection using select2. Here is the code:
state: {
type: Array,
label: 'State',
autoform: {
type: 'select2',
afFieldInput: {
multiple: false,
select2Options: {
placeholder: 'Choose a State',
tags: true,
style: "width: 50%",
closeOnSelect: true
},
options: function() {
return Countries.find({ state: { $exists: true, $ne: [] } }, { fields: { state: 1 } }).map(function(c) {
return {
label: c.state,
value: c._id
}
})
}
}
}
},
'state.$': String,
For some reason, this code doesn’t return anything. Although the countries database has more than 40.000 entries.
Any help will be welcome.