pmogollons:with-search

v1.0.1Published 3 months ago

With Search extension for Zod-Schema

This extension adds support for search queries to Zod-Schema.

How to install:

meteor add pmogollons:with-search

Description

This extension adds support for mongodb $text indexes. If you depend on linked fields this extension will automatically update the searchText field on insert and update.

Other packages

Features

  • Auto generates searchText field on insert and update
  • Support for grapher-nova links

Usage

1import { Mongo } from "meteor/mongo";
2
3const MyCollection = Mongo.Collection("myCollection");
4
5const schema = z.object({
6  name: z.string(),
7  description: z.string(),
8});
9
10MyCollection.withSchema(schema);
11MyCollection.withSearch({
12  fields: ["name", "description"],
13  hasLinks: true, // optional, only set if you use nova and your searchText depends on linked fields
14});