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 🙏

© 2026 – Pkg Stats / Ryan Hefner

loopback-connector-cosmosdb

v0.5.2

Published

LoopBack connector for Microsoft Azure CosmosDB

Readme

loopback-connector-cosmosdb

LoopBack No-SQL connector for Microsoft Azure CosmosDB.

How to install?

Install the connector package to your project:

npm install --save loopback-connector-cosmosdb

Set-up a new data source that uses the connector. In datasources.json, put the following:

{
  "myDataSourceName": {
    "name": "myDataSourceName",
    "connector": "loopback-connector-cosmosdb",
    "host": "YOUR COSMOSDB HOST, TYPICALLY https://myAccount.documents.azure.com:443/",
    "masterKey": "YOUR MASTER KEY",
    "databaseName": "YOUR DATABASE NAME",
    "collectionName": "YOUR COLLECTION NAME",
    
    "enableCrossPartitionQueries": false
  }
}

You can name your data source as you like, here we used myDataSourceName as an example. You can find values for YOUR COSMOSDB HOST, YOUR MASTER KEY, YOUR DATABASE NAME and YOUR COLLECTION NAME in Azure portal. Please consult Azure documentation if needed. Rest of the properties are optional, and default values (shown above) will be used if nothing else is specified.

When configuring model properties, you may want to set specific settings for CosmosDB. For example:

{
  "myViewProperty": {
    "cosmosdb": {
      "propertyName": "myDatabaseProperty"
    }
  }
}  

Special CosmosDB settings are set via cosmosdb configuration object, but this is not required -- connector will use its default values if nothing else is specified in your model configuration. Please consult LoopBack documentation for more details on how to configure models.

You are now ready to start using CosmosDB in your LoopBack application!

Supported features

The following LoopBack's base connector methods are implemented:

  • connect()

  • disconnect()

  • create()

  • updateOrCreate()

  • replaceOrCreate()

  • replaceById()

  • all()

  • save()

  • count()

  • update()

  • destroyAll()

  • updateAttributes()

Connector debug string is loopback:connector:cosmosdb that can be enabled through DEBUG environment variable.

Change log

  • 0.0.1 -- Initial release.

  • 0.0.2 -- Add support to cross-partition queries. Support filter.orderBy.

  • 0.1.0 -- Add support to where filtering operators (see https://loopback.io/doc/en/lb3/Where-filter.html#operators). All but near, between and regexp are supported.

  • 0.1.2 -- Non-model properties are dropped when saving documents.

  • 0.1.3 -- Fix inq and nin where filtering operators.

  • 0.2.0 -- Add possibility to map database properties to different view properties. Fix sub-level logical query construction in where filtering. Support between operator in where filtering.

  • 0.2.1 -- Fix lt and lte where filtering operators.

  • 0.3.0 -- Add support case-insensitive properties.

  • 0.3.1 -- Fix error that resulted when filtering by properties that are not in model.

  • 0.4.0 -- Fix order where filtering. Support array types. Add any where filter that works with array properties. Fix bug https://bitbucket.org/houstoninc/loopback-connector-cosmosdb/issues/1/if-a-model-has-a-property-named-value-a.

  • 0.4.1 -- Fix how logical clauses are constructed in where filtering.

  • 0.4.2 -- Handle empty logical clauses correctly.

  • 0.5.0 -- Add support for request retrying. Add workaround for LOWER() bug in CosmosDB.

  • 0.5.1 -- Retry also in destroyAll and update functions.

  • 0.5.2 -- Fix bug in update function. Fix document replace and queries to case-insensitive properties.