我需要在数组元素内执行文本搜索。是否可以?
在 Node.js 中使用 Mongoose,我的 userSchema 如下所示:
{
_id: "123456",
name: "Lucas"
items: [
{ title: "Shoes", description: "Very nice shoes"},
{ title: "Pants", description: "Great pants!"}
]
}
Run Code Online (Sandbox Code Playgroud)
我试图添加这样的索引:
userSchema.index({ "items.title": "text", "items.description": "text" });
Run Code Online (Sandbox Code Playgroud)
但以下查询不返回任何内容:
User.find({ $text: { $search: "Shoes" }});
Run Code Online (Sandbox Code Playgroud) 我正在使用电容器插件来获取图像文件(从相机或图库)。PC 和 Android 运行良好,但代码在 iPhone 上崩溃。
它打开图库,我抓取图像,但在尝试显示时崩溃了
我检查了权限,它们都已设置。为什么只在ios上会崩溃?是不是弦有问题?安全?
HTML:
< ion-img role="button" class="image" [src]="selectedImage" *ngIf="selectedImage" >
Run Code Online (Sandbox Code Playgroud)
交易代码:
Plugins.Camera.getPhoto({
quality: 100,
source: CameraSource.Prompt,
correctOrientation: true,
allowEditing: false,
resultType: CameraResultType.Base64
})
.then(image => {
this.selectedImage = image.base64Data; // VAR TO DISPLAY IN HTML
})
Run Code Online (Sandbox Code Playgroud)
错误日志
编辑:现在我使用 DomSanitizer 和 SafeResourceUrl 来变量。错误停止了,但图像不会显示