All Projects → algolia → mongoolia

algolia / mongoolia

Licence: other
Keep your mongoose schemas synced with Algolia

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mongoolia

ark.db
Small and fast JSON database for Node and browser. 😋
Stars: ✭ 65 (+12.07%)
Mutual labels:  mongo, mongoose
express-mongo-jwt-boilerplate
Express Mongo JsonWebToken boilerplate
Stars: ✭ 100 (+72.41%)
Mutual labels:  mongo, mongoose
derivejs
DeriveJS is a reactive ODM - Object Document Mapper - framework, a "wrapper" around a database, that removes all the hassle of data-persistence by handling it transparently in the background, in a DRY manner.
Stars: ✭ 54 (-6.9%)
Mutual labels:  mongo, mongoose
server-next
😎 The next generation of RESTful API service and more for Mix Space, powered by @nestjs.
Stars: ✭ 43 (-25.86%)
Mutual labels:  mongo, mongoose
mongoose-morgan
An npm package for saving morgan log inside MongoDB
Stars: ✭ 14 (-75.86%)
Mutual labels:  mongo, mongoose
Mern Passport
A boilerplate example of using passport.js for authenticating a MERN application
Stars: ✭ 214 (+268.97%)
Mutual labels:  mongo, mongoose
koa-session-mongoose
Mongoose store for Koa sessions
Stars: ✭ 29 (-50%)
Mutual labels:  mongo, mongoose
Mongoose Fuzzy Searching
Mongoose Fuzzy Searching Plugin
Stars: ✭ 94 (+62.07%)
Mutual labels:  mongo, mongoose
uuid-mongodb
📇 Generates and parses MongoDB BSON UUIDs
Stars: ✭ 94 (+62.07%)
Mutual labels:  mongo, mongoose
NodeScalableArchitecture
A Scalable Node Architecture/Server. This repository contains a complete implementation of writing scalable nodejs server/architecture on my medium blog.
Stars: ✭ 62 (+6.9%)
Mutual labels:  mongo, mongoose
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (+150%)
Mutual labels:  mongo, mongoose
NodeRestApi
Node.js, Express.js and MongoDB REST API App
Stars: ✭ 38 (-34.48%)
Mutual labels:  mongo, mongoose
Intro Mongo Db
[Course] Introduction to MongoDB code
Stars: ✭ 114 (+96.55%)
Mutual labels:  mongo, mongoose
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (+163.79%)
Mutual labels:  mongo, mongoose
Node Typescript Mongodb
node js typescript mongodb express generator yo
Stars: ✭ 96 (+65.52%)
Mutual labels:  mongo, mongoose
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (+262.07%)
Mutual labels:  mongo, mongoose
Mean Angular4 Chat App
MEAN stack with Angular 4 Chat App
Stars: ✭ 41 (-29.31%)
Mutual labels:  mongo, mongoose
Mean Stack Angular6 Crud Example
MEAN Stack Angular 6 CRUD Web Application
Stars: ✭ 69 (+18.97%)
Mutual labels:  mongo, mongoose
mern-stack-crud
MERN stack (MongoDB, Express, React and Node.js) create read update and delete (CRUD) web application example
Stars: ✭ 142 (+144.83%)
Mutual labels:  mongo, mongoose
mongoose-slug-plugin
Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
Stars: ✭ 21 (-63.79%)
Mutual labels:  mongo, mongoose

mongoolia

Keep your Mongoose schemas synced with Algolia

While this plugin was created by Algolia, it is not an officially supported API client. It is possible that future major versions of Mongoose break compatibility, or require changes.

This plugin will automatically synchronise your models with an Algolia index every time a new document is added, updated or removed.

You can also index your whole collection if you didn't use this plugin when you started using mongoose.

How to

Only supports mongoose v4

First install the library:

  • > yarn add mongoolia OR
  • > npm add mongoolia -S

Then you need to specify which fields of your schema you want to index with Algolia and register the plugin to your mongoose model created with this schema:

// ES6
import mongoose from 'mongoose';
import mongoolia from 'mongoolia';

// ES5
const mongoose = require('mongoose');
const mongoolia = require('mongoolia').default;

// Pass `{algoliaIndex: true}` to push theses attributes for indexing to Algolia
const BookSchema = new mongoose.Schema({
  title: { type: String, required: true, algoliaIndex: true },
  author: { type: String, required: true, algoliaIndex: true },
  description: { type: String, required: true, algoliaIndex: true }
});

// Specify your Algolia credentials which you can find into your dashboard
BookSchema.plugin(mongoolia, {
  appId: 'xxxxx',
  apiKey: 'xxxx',
  indexName: 'xxxx'
})

Options

Option name Type Description
appId* string The Algolia application ID
apiKey* string The Algolia admin API key
indexName* string The name of the index you want to push data

Methods

After applying the mongoolia plugin to your mongoose model it registers new static methods:

Model.syncWithAlgolia(): Promise

Index the whole collection into your Algolia index.

Model.clearAlgoliaIndex(): Promise

Clears your Algolia index and remove _algoliaObjectID from your documents.

Model.setAlgoliaIndexSettings(settings: {}, forwardToReplicas: boolean): Promise

Set one or more settings of the Algolia index, the full settings list is available here.

Model.algoliaSearch({ query: string, params?: {}, populate?: boolean }): Promise

Search into your Algolia index for a specific query. You can customize the search parameters as well.

You can find the full list of search parameters here, you should look for settings tagged with search.

The server response will look like:

{
  "hits": [
    {
      "firstname": "Jimmie",
      "lastname": "Barninger",
      "objectID": "433",
      "_highlightResult": {
        "firstname": {
          "value": "<em>Jimmie</em>",
          "matchLevel": "partial"
        },
        "lastname": {
          "value": "Barninger",
          "matchLevel": "none"
        },
        "company": {
          "value": "California <em>Paint</em> & Wlpaper Str",
          "matchLevel": "partial"
        }
      }
    }
  ],
  "page": 0,
  "nbHits": 1,
  "nbPages": 1,
  "hitsPerPage": 20,
  "processingTimeMS": 1,
  "query": "jimmie paint",
  "params": "query=jimmie+paint&attributesToRetrieve=firstname,lastname&hitsPerPage=50"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].