These are chat archives for reactioncommerce/reaction

5th
Dec 2017
CF
@ChenfengLiu
Dec 05 2017 00:23
@joshuacox Thank you so much~~!
CF
@ChenfengLiu
Dec 05 2017 03:29
Hi guys, I just built my docker image and pushed it to gcloud. but when I run the docker container it tells me that "mongo not installed inside the container".
docker-run-error2.png
Jeremy Shimko
@jshimko
Dec 05 2017 03:30
You need to either provide a MONGO_URL or install mongo inside the container
CF
@ChenfengLiu
Dec 05 2017 03:30
i tried to run the container with MONGO_URL="mongodb://127.0.0.1:27017/reaction", but it shows the same error message.
Jeremy Shimko
@jshimko
Dec 05 2017 03:31
because you haven’t actually installed mongo in the container.
and you shouldn’t for anything other than a development test environment
if you want to install mongo inside the container for testing purposes…
docker build --build-arg INSTALL_MONGO=true -t my-reaction:latest .
CF
@ChenfengLiu
Dec 05 2017 03:34
So if I want to build a container for production, I need to install mongo in the container?
Jeremy Shimko
@jshimko
Dec 05 2017 03:35
No, if you want a production deployment, you should provide a MONGO_URL for a production deployment of Mongo
CF
@ChenfengLiu
Dec 05 2017 03:38
Oh, I see. Thank you for your response. I should look more into setting up a mongoDB server.
Jeremy Shimko
@jshimko
Dec 05 2017 03:41
If you’re not using a Mongo hosting provider, an example Docker Compose config for a sepatate Mongo container might look like this…
reaction:
  image: reactioncommerce/reaction:latest
  links:
    - mongo
  ports:
    - "80:3000"
  environment:
    ROOT_URL: "http://example.com"
    MONGO_URL: "mongodb://mongo:27017/reaction"

mongo:
  image: mongo:latest
  command: mongod --storageEngine=wiredTiger
  volumes:
    - /opt/mymongodata:/data/db
and the data from the database would end up in /opt/mymongodata
but if Docker or Docker volume management is new to you, you may want to consider a Mongo hosting provider.
CF
@ChenfengLiu
Dec 05 2017 03:49
is there any recommend on hosting providers besides DigitalOcean? (free? ha)
Jeremy Shimko
@jshimko
Dec 05 2017 03:50
free hosting? not sure that’s a thing
CF
@ChenfengLiu
Dec 05 2017 03:52
Yeah... You are right...
I will look into it. Thank you so much! @jshimko
Josh Cox
@joshuacox
Dec 05 2017 07:03
@jshimko @ChenfengLiu TANSTAAFL =There Aint No Such Thing As A Free Lunch <-- that has stayed true for nearly a century if not more, by the way The Moon is a Harsh Mistress if you were unaware
hitachi19
@hitachi19
Dec 05 2017 07:45
what is "ancestors.1" mean?
     function getTopVariant(productId) {
     const topVariant = Products.findOne({
     "ancestors": { $in: [productId] },
     "ancestors.1": { $exists: false }
     });
     return topVariant;
     }
hitachi19
@hitachi19
Dec 05 2017 08:05
@prinzdezibel hi,what is "ancestors.1" mean?
function getTopVariant(productId) {
const topVariant = Products.findOne({
"ancestors": { $in: [productId] },
"ancestors.1": { $exists: false }
});
return topVariant;
}
in https://docs.reactioncommerce.com/reaction-docs/master/fixtures-images
Michael Jenny
@prinzdezibel
Dec 05 2017 08:06
@hitachi19 ancestors is an array of parent ids. and 1 means the index into the array, i.e. Item 2 .
so this is looking for documents that have not 2 parents, but at most 1
these are the primary product-variants
hitachi19
@hitachi19
Dec 05 2017 08:16
@prinzdezibel thank you very much ! i will try it in mongodb
1.JPG
Michael Jenny
@prinzdezibel
Dec 05 2017 08:40
@hitachi19 "ancestors.1" is a string terminal and not meant to be evaluated by the JavaScript engine. Instead it's processed by MongoDB.
You can't use it in native Javascript arrays.
hitachi19
@hitachi19
Dec 05 2017 08:48
@prinzdezibel now i see, thank you very much !
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:04
hello,
i want fetch products and running this -> Products.find({})
nothing is coming up
and i also check minimongoExplorer chrome tool but Products table has 0 records.
image.png
is anyone help me to figure out this ?
Brent Hoover
@zenweasel
Dec 05 2017 13:07
Have you published your products?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:07
yes
Brent Hoover
@zenweasel
Dec 05 2017 13:08
Have you made them visible?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:23
yes
Brent Hoover
@zenweasel
Dec 05 2017 13:25
Is this a single shop?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:26
yes
i want to display product in our custom template.
import { Products } from "/lib/collections";
Products.find({}).fetch()
Brent Hoover
@zenweasel
Dec 05 2017 13:27
what do you get if you do Products.find({ isVisible: true }) from the meteor shell?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:27
but i am getting empty result
i run this on meteor shell
image.png
meteor shell returns results.
Brent Hoover
@zenweasel
Dec 05 2017 13:30
Can you do Products.find({ isVisible: true }).count()?
and what route are you on when you see no records? Are you the home page?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:31
no, i am in tag page
Brent Hoover
@zenweasel
Dec 05 2017 13:31
what happens if you go to the home page?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:33
we are customizing the existing layout according to our needs. so the home page is completely changed.
Brent Hoover
@zenweasel
Dec 05 2017 13:33
do you know the id of the tag of the page you are on?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:33
yes
Brent Hoover
@zenweasel
Dec 05 2017 13:35
what do you get if you query for products with that hashtag?
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:36
it returns empty
Products.find({ hashtag: /tagid/ });
Brent Hoover
@zenweasel
Dec 05 2017 13:37
so it doesn’t look like any products have the hashtag you are trying to display
maybe try: Products.find({hashtags: {$in: [“tagId"]} });
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:38
tag has many products.
yes, i did that also
Brent Hoover
@zenweasel
Dec 05 2017 13:38
if they are not applied to the product then they won’t display on the tag page
The query shows which products have that hashtag applied
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:38
ok
but i run simply- Products.find({}), this query must returns records.
Brent Hoover
@zenweasel
Dec 05 2017 13:40
Right, it did above in the results. you posted
on the client side the publication is changed depending on the route. So on a tag page only the products for that page are published
we don’t just push all products down to the client all the time
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:42
ok
Brent Hoover
@zenweasel
Dec 05 2017 13:43
if you look at https://swag.getreaction.io you can see that you have 27 products published on the home page but if you go to tag/apparel only 12 products are published
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:48
ok
but when i run Products.find({ hashtags: {$in: ["w3q6KMciMeAsTwCCp"]} }) on our template, it return blank. but i run this on meteor shell, it return record.
Brent Hoover
@zenweasel
Dec 05 2017 13:50
Right, queries from the shell are direct to the database. Queries on the client are against the publication
it doesn’t matter what’s in the database if those records aren’t published
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:50
ok
Brent Hoover
@zenweasel
Dec 05 2017 13:51
even though you have customized the home page, the publication for the index route should still be the same so if you go to / you should still get all (up to your scroll limit) of products
gopeshcitpl
@gopeshcitpl
Dec 05 2017 13:59
ok
machiko
@machikoyasuda
Dec 05 2017 15:57
Hi all! Reaction Action is about to start: http://getrxn.io/reaction-action-dec
Sophie He
@sophiehe
Dec 05 2017 15:57
This link goes straight to the webinar! https://reactioncommerce.zoom.us/j/931132108
We'll also be streaming on YouTube. Will post the link in a second.
machiko
@machikoyasuda
Dec 05 2017 16:02
:tv: Watch Reaction Action on YouTube: https://www.youtube.com/watch?v=LbIumqJstWk