每次在Web界面中创建服务时,都会创建一个名为“ xxx_xxx”的集合,问题是
How to create collection named not "xxx_xxx" but "xxx"?
Foxx will automatically prefix the name based on the mount path of the service. That's intentionally to avoid conflicts with other services.
You could use a non-prefix "xxx" collection as well if you use the low-level db._collection
method to access this collection.
In the corresponding documentation you find suggestions on how to share collections between services as well: https://docs.arangodb.com/3.4/Manual/Foxx/Guides/Collections.html
Example Route /some_products
:
router.get('/some_products', function (req, res) {
res.set("Content-Type", "text/plain; charset=utf-8");
const { db, aql } = require("@arangodb");
const query = aql`
FOR doc IN products
LIMIT 10
RETURN doc
`;
res.json(db._query(query).toArray());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.