Solve the problem that the WeChat applet cloud development model cannot obtain database data
problem:
There are two pieces of data in the database, and nothing happens in the output window when the data is obtained.
wrong reason:
- Check whether the database name corresponds
- Check if you have multiple cloud development environments.
If you have multiple cloud development environments, you need to specify the environment. Otherwise, your first development environment will be selected by default. At this time, the environment where the data is created is inconsistent with the environment you read. The above non-response problem.
solve:
Enter the name of the environment where you store the data in env in app.js, save it, and
run at this time
New problem
There is a response but there is no data at this time. This is because you have not opened all human-readable permissions in the database permissions.
Solve new problems
Find the cloud development console and change the data permissions to be readable by all users, only the creator can read and write, just save it
and run again at this time