GoodDB
    Preparing search index...
    • Find a key in a collection

      Parameters

      • this: GoodDB
      • key: string

        The key to find in the collection

      • callback: (value: any, index: number, obj: any[]) => unknown

        The callback find function to use

      • Optionaloptions: methodOptions

        The options to use

      Returns any

      A promise if the driver is async, otherwise a value

      const db = new GoodDB(new JSONDriver({
      path: './database.json'
      }));

      db.find('key', (value) => value === 'value');
      const db = new GoodDB(new MongoDBDriver({
      uri: "..."
      }));

      await db.connect();

      await db.find('key', (value) => value === 'value');