npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

firestore-db

v0.2.3

Published

A wrapper for Firestore to query data easily with Syntax inspired by Mongoose

Downloads

25

Readme

Firestore DB

A wrapper for Firestore to query data easily and intuitively with Syntax inspired by Mongodb / Mongoose works with web as well as react-native-firebase sdk.

Install

npm install firestore-db

Example

import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import { queryBuilder } from 'firestore-db';

// import firestore from '@react-native-firebase/firestore';    // Only for react-native-firebase

const Users = queryBuilder(firebase.firestore().collection("users"));

// One user with firstName John
const OneJohn = Users.findOne({firstName:"John"});

// users age grater than 18 and firstName is John
const findAllAdults = Users.find({ firstName:"John", age:{">=",18}});

//Find All Users From New York and Los Angeles
const NYLA_users = Users.find({
city :["New York","Los Angeles"]
})

// Partial and Matching Text Search
// Find users First Name Starting with Joh
const SearchedUsers = Users.search("firstName","Joh")

###Queries find() : find can take an object containing key value pair where query can be string, array or object with operator and value. the param bjects can also take orderBy and limit and returns and array of results no need to call data() functions to get the results. ex :

users.find({
	firstName:"John",
	city :["New York","Los Angeles"],
	age : {">=",18},
	limit:10,
	orderBy:"createdAt",
	//or  orderBy: ['createdAt', 'asc']  // with acs/desc
	//or orderBy: [['userId', 'desc'], ['createdAt', 'asc']] // multiple orderby
	})

| Function name | Description | Params | Return | | -------------- | ----------------------------------------------------- | --------------------------------------------------- | ----------------------------------- | | findOne() | returns First Matching result | same as find() | object Ex: {name:"",age:"",id:""} | | findById() | Finds Matching doc with id | id | object Ex: {name:"",age:"",id:""} | | create() | Creates New Doc | object Ex: {name:"",age:"",} | Resove/Reject | | update() | Updates Existing Doc | id,updatedObject Ex: "uudefdsds",{name:"",age:""} | updatedObject | | deleteOne() | Delete one Doc with id | id Ex: "uudefdsds" | Resove/Reject | | deleteMany() | Deletes all docs from list of ids | Array Ex: [id1,id2,...] | Resove/Reject | | search() | Simple Text Search with matching Prefix or Whole Text | key and searchterm Ex: "name","Joh" | updatedObject |

Note: ids and Keys will always be strings