gpt4 book ai didi

javascript - 如何在不获取列名的情况下查询书架

转载 作者:行者123 更新时间:2023-11-29 20:21:38 25 4
gpt4 key购买 nike

这是我的 table 。

CREATE TABLE `information_yourself` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '',
`body` text,
PRIMARY KEY (`id`)

INSERT INTO `information_yourself` (`id`, `title`, `body`)
VALUES
(1, 'test1', 'content1');
(2, 'test2', 'content2');
(3, 'test3', 'content3');
(4, 'test4', 'content4');

这是我使用 Node 模块书架的查询

router.get('/', function(req, res){
information.where({id:1})
.fetch({ columns: ['body'] })
.then(function(model){
var obj = JSON.stringify(model);
var str = obj.replace(/[\[\]\{\}]+/g, '');
res.render('test.ejs', {str});
})

})

结果是 '"body":'content1'。

如何只接收结果“内容 1”而不检索列名称?

任何帮助将不胜感激。

最佳答案

尝试修改此行

 var obj = JSON.stringify(model);

 var obj = JSON.stringify(model['body']);

这可能有帮助!

关于javascript - 如何在不获取列名的情况下查询书架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39478438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com