【发布时间】:2021-01-15 05:22:34
【问题描述】:
尝试在 https://docs.marklogic.com/9.0/guide/entity-services/getting-started#id_75988 的实体服务中仔细完成此练习 我一直按照信中的说明进行操作,到目前为止一切顺利,直到现在。 MarkLogic 服务器版本为 9.0-8.2
当我尝试运行位于“查询数据”部分的代码(如下)时:
'use strict';
import jsearch from '/MarkLogic/jsearch.mjs';
// Find all occurences of lastName with the value 'washington' contained
// in an es:instance element. Return just the documents in the results.
const people = jsearch.collections('person-envelopes');
const matches = people.documents()
.where(cts.elementQuery(
fn.QName('http://marklogic.com/entity-services', 'instance'),
cts.elementValueQuery('lastName', 'washington')))
.map(match => match.document)
.result();
错误:
[javascript] JS-JAVASCRIPT: import jsearch from ('/MarkLogic/jsearch'); -- Error running JavaScript
request: SyntaxError: Unexpected token import
Stack Trace
At line 2 column 21:
In import jsearch from ('/MarkLogic/jsearch');
1. 'use strict';
2. import jsearch from ('/MarkLogic/jsearch');
3. // Find all occurences of lastName with the value 'washington' contained
4. // in an es:instance element. Return just the documents in the results.
有人可以建议解决方法或解决方案吗?我花了一段时间试图找到解决方案,但没有快乐。不确定网络浏览器(Brave 浏览器的最新版本)是否是问题的一部分。
可能替换
import jsearch from '/MarkLogic/jsearch.mjs';
与
const jsearch = require('/MarkLogic/jsearch.sjs');
?
【问题讨论】:
标签: marklogic