So I have been working on an educational app where I have a collection of roughly 1500 minerals. The idea is I want this data offline 24/7 so the kids can look up the information whenever they want.
Since this is my first app using meteor I followed a couple of tutorials and have the pub/sub working with a collection from the server. I used:
mongoimport -h localhost:3001 --db meteor --collection minerals --type json --file baseDb.json --jsonArray
to load the collection I designed. Now I have been trying to refactor my project to make it so that the db is grounded and can’t seem to get it to work.
For instance in the file imports/api/minerals.js since I am using a simple schema I have the collection exported from there using
export const Minerals = new Meteor.Collection('minerals');
I tried to ground the collection there and export it following the Ground:DB documentation. but i end up inundated by "Uncaught Error: Meteor does not currently support objects other than ObjectID as ids"
. So I checked the data and it one entry looks like
{ “_id” : ObjectId(“5925e8203945a2236ae2d0cc”), “minName” : “Quetzalcoatlite”,
“summary” : “Named for the feathered snake god, Quetzalcoatl, whom the Toltec and Aztec people believed was the god of the sea, in reference to the minerals sea-blue color. Quetzalcoatlite can be found only at its type locality at the Bambollita Mine at Moctezuma, Mexico, and within the United States in Arizona, California, and Utah. This rare mineral is found in oxidized hydrothermal deposits that contain tellurium.”,
“formula” : “Cu2+3Zn6Te6+2O12(OH)6·(Ag,Pb,[ ])Cl”,
“crystalSystem” : “Hexagonal”,
“crystalHabit” : “”,
“cleavage” : “Distinct, None, None”,
“luster” : “Pearly”,
“color” : “blue”,
“streak” : “Pale blue, almost white”,
“classType” : “Hexagonal - Trapezohedral”,
“fracture” : “Brittle”,
“hardness” : [ 3 ],
“category” : “Oxides” }
I know that the _id was added when I used mongoimport and it looks like the object ID that is needed. I have tried researching this topic but I have had no luck. I came across a lot of topics but I couldn’t find any solutions. I have the feeling the solution is more then just a couple lines of code but rather, that I am missing something in my understanding of collections and the pub/sub architecture (if thats the right description).
My full project is here https://github.com/Afro523/MineralID-Meteor if anyone is interested in looking at the whole thing.
Any advice/ideas would be much appreciated and if I missed something important in my explanation I will clarify asap. Thank you to anyone in advanced!