Reputation: 3878
I'm trying to use the meteorimport
to import a product and it's many variants into the app.
It's able to import the product that I see show up in the web app, but in the miniMongo chrome extension it doesn't list the imported product or it's variants.
The meteor shell lists them with db.Products.find()
but when I try to db.Products.find()
for the specific product ID, nothing results.
Here's the Products.json I'm trying to import: https://gist.github.com/mikeumus/a5133eb710a5aacb0b4dc9e6b5662026
{ "-id" : "Faux-Wood-Blinds", "title" : "Faux Wood Blinds", "shopId" : "J8Bhq3uTtdgwZx3rz", "ancestors" : [], "createdAt" : Date( 1396558012411 ),
...
The meteorimport
is successful:
mikeumus@cbc-instance-5:~/rc-ca-blinds$ mongoimport --db meteor --collection Products --file ./fauxwood-cbc-mongodb.json/meteor/Products.json --port 3001 --jsonArray
connected to: 127.0.0.1:3001
2018-03-09T19:29:29.300+0000 check 9 28
2018-03-09T19:29:29.301+0000 imported 28 objects
Should I not be importing from the meteor mongo shell like this? Can I use Reaction.import.Object() or Reaction.import.Product() for this instead?
Upvotes: 0
Views: 218
Reputation: 3878
The gist shows some issues in the json like Date()
isn't valid and it needs to be wrapped in square brackets []
as seen in the official Reaction Commerce example plugin /private/data/Products.json
here:
The file I was trying to import was converted from Mongo's bsondump
tool and I didn't look at it close enough before trying to import it.
Not to mention the knowledge that the /private/data/
folder both in Reaction Commerce (RC) and in an RC plugin, will import any collection items upon startup of the server.
Upvotes: 0