📇 Generates and parses MongoDB BSON UUIDs

Overview

uuid-mongodb

Codacy Badge All Contributors

Generates and parses BSON UUIDs for use with MongoDB. BSON UUIDs provide better performance than their string counterparts.

Inspired by @srcagency's mongo-uuid

Install

npm install uuid-mongodb

Usage

const MUUID = require('uuid-mongodb');

# Create a v1 binary UUID
const mUUID1 = MUUID.v1();

# Create a v4 binary UUID
const mUUID4 = MUUID.v4();

# Print a string representation of a binary UUID
mUUID1.toString()

# Create a binary UUID from a valid uuid string
const mUUID2 = MUUID.from('393967e0-8de1-11e8-9eb6-529269fb1459')

# Create a binary UUID from a MongoDb Binary
# This is useful to get MUUIDs helpful toString() method
const mUUID3 = MUUID.from(/** MongoDb Binary of SUBTYPE_UUID */)

Formatting

UUIDs may be formatted using the following options:

Format Description Example
N 32 digits 00000000000000000000000000000000
D 32 digits separated by hyphens 00000000-0000-0000-0000-000000000000
B 32 digits separated by hyphens, enclosed in braces {00000000-0000-0000-0000-000000000000}
P 32 digits separated by hyphens, enclosed in parentheses (00000000-0000-0000-0000-000000000000)

example:

const mUUID4 = MUUID.v4();
mUUID1.toString(); // equivalent to `D` separated by hyphens
mUUID1.toString('P'); // enclosed in parens, separated by hypens
mUUID1.toString('B'); // enclosed in braces, separated by hyphens
mUUID1.toString('N'); // 32 digits

Modes

uuid-mongodb offers two modes:

  • canonical (default) - A string format that emphasizes type preservation at the expense of readability and interoperability.
  • relaxed - A string format that emphasizes readability and interoperability at the expense of type preservation.

The mode is set globally as such:

const mUUID = MUUID.mode('relaxed'); // use relaxed mode

Mode only impacts how JSON.stringify(...) represents a UUID:

e.g. JSON.stringy(mUUID.v1()) outputs the following:

"DEol4JenEeqVKusA+dzMMA==" // when in 'canonical' mode
"1ac34980-97a7-11ea-8bab-b5327b548666" // when in 'relaxed' mode

Examples

Query using binary UUIDs

const uuid = MUUID.from('393967e0-8de1-11e8-9eb6-529269fb1459');
return collection.then(c =>
  c.findOne({
    _id: uuid,
  })
);

Work with binary UUIDs returned in query results

return collection
  .then(c => c.findOne({ _id: uuid }))
  .then(doc => {
    const uuid = MUUID.from(doc._id).toString();
    // do stuff
  });

Examples (with source code)

Native Node MongoDB Driver example

  • example/ex1-mongodb.js

    snippet:

     const insertResult = await collection.insertOne({
       _id: MUUID.v1(),
       name: 'carmine',
     });

Mongoose example

  • example/ex2-mongoose.js

    snippet:

     const kittySchema = new mongoose.Schema({
       _id: {
         type: 'object',
         value: { type: 'Buffer' },
         default: () => MUUID.v1(),
       },
       title: String,
     });
  • example/ex3-mongoose.js

    snippet:

     // Define a simple schema
     const kittySchema = new mongoose.Schema({
       _id: {
         type: 'object',
         value: { type: 'Buffer' },
         default: () => MUUID.v1(),
       },
       title: String,
     });
     
     // no need for auto getter for _id will add a virtual later
     kittySchema.set('id', false);
     
     // virtual getter for custom _id
     kittySchema
       .virtual('id')
       .get(function() {
         return MUUID.from(this._id).toString();
       })
       .set(function(val) {
         this._id = MUUID.from(val);
       });
  • example/ex4-mongoose.js

    const uuid = MUUID.v4();

    // save record and wait for it to commit
    await new Data({ uuid }).save();

    // retrieve the record
    const result = await Data.findOne({ uuid });

Notes

Currently supports UUID v1 and v4

Contributors

Thanks goes to these wonderful people (emoji key):

Carmine DiMascio
Carmine DiMascio

💻
Benjamin Dobell
Benjamin Dobell

💻
David Pfeffer
David Pfeffer

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

Buy Me A Coffee

Comments
  • Hex uuids in JSON

    Hex uuids in JSON

    I was surprised that JSON.stringify on my MUUIDs generated base64 and not hex. To fix this I forked the repo and added mu.toJSON = mu.toString; to the apply() function. I could do a PR but I'm not sure if people are counting on the base64 behavior.

    opened by irothschild 13
  • Mongodb 4.6.x through to 4.12.x driver update

    Mongodb 4.6.x through to 4.12.x driver update

    • Updated dependencies. Added support for the mongodb v4.6.x, v4.7.x, v4.8.x & 4.9.x drivers as a peer dependency. Remove the dev dependency on the driver itself as it is not required for tests to pass. This may or may not be appropriate, but pinning the MongoDB driver as a dev dependency seems undesirable.
    • Updated other devDependencies to the latest versions.
    • All tests pass.
    opened by erichkuba 9
  • Implemented the specific types used in the mode function

    Implemented the specific types used in the mode function

    The current declaration of the mode function in lib/index.d.ts is causing downstream typescript projects to require the "noImplicitAny" flag to be set to false in the compiler options. This is not desirable for some/most projects, so this PR implements specific types for the function declaration.

    opened by erichkuba 8
  • Adds basic formatting similar to .NET

    Adds basic formatting similar to .NET

    My primary use case for this is an easy way to create the UUID string without dashes. However, I figured other formatting use cases were relevant as well. Microsoft has already thought through the most common use cases in .NET, so I copied the majority of their formatting argument options.

    opened by bytenik 8
  • .find does not work

    .find does not work

    my schema has a field of type Buffer subtype 4 (uuid), then I'm trying to use this package to find data based on uuid

    import MUUID from 'uuid-mongodb';
    
    const Data = new mongoose.Schema({
    uuid: {
          type: Buffer,
          subtype: 4,
          default: () => uuidv4(),
    
          required: true,
          unique: true,
          index: true,
        },
    })
    
    const data = new Data({}).save();
    
    const all = await Data.findOne({ uuid: MUUID.from(data.uuid.toString()})
    
    

    all is returning an empty array

    question 
    opened by sibelius 6
  • Not working with Mongoose v6

    Not working with Mongoose v6

    One of my services is running with Mongoose 6.0.5, all other services with 5.13.8.

    v6 returns (will apply to all binary UUIDs, not only for the _id key): _id: new Binary(Buffer.from("738bb413b6344587a87b7ad109eb6f8a", "hex"), 4),

    But it's well working with Mongoose v5:

     _id: Binary {
        _bsontype: 'Binary',
        sub_type: 4,
        position: 16,
        buffer: <Buffer 73 8b b4 13 b6 34 45 87 a8 7b 7a d1 09 eb 6f 8a>
      }
    

    Also have tried a few uuid-mongodb versions.

    opened by xairoo 4
  • Mongoose Example in Docs

    Mongoose Example in Docs

    [NOT A BUG] Just a documentation request.

    Considering that even in the package.json since its written that the plugin is fully compatible with Mongoose, it would be helpful if a simple Schema example for Mongoose can be added here.

    opened by alokrajiv 4
  • Doesn't work with ES6 imports and TypeScript

    Doesn't work with ES6 imports and TypeScript

    The following throws the compilation error 'MUUID' only refers to a type, but is being used as a value here.

    import { MUUID } from 'uuid-mongodb';
    
    const muuid = MUUID.from('393967e0-8de1-11e8-9eb6-529269fb1459');
    
    question 
    opened by IGassmann 3
  • Update to latest MongoDB

    Update to latest MongoDB

    warning " > [email protected]" has incorrect peer dependency "[email protected] || 3.7.x || 4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x".
    

    latest: 4.10.0

    Is it still necessary to pin these dependencies? Does the mongodb project follow SemVer?

    opened by jessbowers 2
  • Mongodb 4.6.x & 4.7.x driver update

    Mongodb 4.6.x & 4.7.x driver update

    Updated dependencies. Added support for the mongodb v4.6.x & v4.7.x drivers as a peer dependency. Remove the dev dependency on the driver itself as it is not required for tests to pass. This may or may not be appropriate, but pinning the MongoDB driver as a dev dependency seems undesirable. Tests pass.

    opened by erichkuba 1
  • Added support for mongodb 4.6.x peer dependency

    Added support for mongodb 4.6.x peer dependency

    Updated dependencies. Added support for the mongodb v4.6.x as a peer dependency. Remove the dev dependency on the driver itself as it is not required for tests to pass. This may or may not be appropriate, but pinning the MongoDB driver as a dev dependency seems undesirable. Tests pass.

    opened by erichkuba 1
  • chore(deps): bump mongoose from 6.0.13 to 6.4.6 in /examples

    chore(deps): bump mongoose from 6.0.13 to 6.4.6 in /examples

    Bumps mongoose from 6.0.13 to 6.4.6.

    Release notes

    Sourced from mongoose's releases.

    6.4.6 / 2022-07-20

    • fix(schema): disallow setting proto when creating schema with dotted properties #12085
    • fix(document): avoid mutating original object passed to $set() when applying defaults to nested properties #12102
    • fix(query): apply lean transform option to top-level document #12093
    • docs(migrating_to_6): correct example for isObjectIdOrHexString() #12123 LokeshKanumoori

    6.4.5 / 2022-07-18

    • fix(model+timestamps): set timestamps on subdocuments in insertMany() #12060
    • fix: correct isAtlas check #12110 skrtheboss
    • fix(types): fix various issues with auto typed schemas #12042 mohammad0-0ahmad
    • fix(types): allow any value for AddFields #12096
    • fix(types): allow arbitrary expressions for ConcatArrays #12058
    • fix(types): make $addToSet fields mutable to allow programatically constructing $addToSet #12091
    • fix(types): add $let as a possible expression to $addFields #12087 AbdelrahmanHafez
    • fix(types): fix $switch expression type #12088 AbdelrahmanHafez
    • fix(types): correct options type for syncIndexes() #12101 lpizzinidev
    • fix(types): avoid treating | undefined types as any in Require_id to better support _id: String with auto-typed schemas #12070
    • docs: fix up various jsdoc issues #12086 hasezoey
    • docs: add sanitizeFilter to mongoose.set() options #12112 pathei-kosmos

    6.4.4 / 2022-07-08

    6.4.3 / 2022-07-05

    • fix(document): handle validating deeply nested subdocuments underneath nested paths with required: false #12021
    • fix(types): infer schematype type from schema paths when calling SchemaType.path() #11987
    • fix(types): add $top and $topN aggregation operators #12053
    • fix(types): clean up a couple of issues with $add and $ifNull #12017
    • fix(types): allow $cond with $in #12028
    • docs: add path level descending index example in docs #12023 MitchellCash
    • docs: add Buffer, Decimal128, Map to docs #11971

    6.4.2 / 2022-07-01

    • fix: keep autoIndex & autoCreate as true by default if read preference is primaryPreferred #11976
    • fix(types): improve inferred Schema Type to handle nested paths and ObjectIds #12007 iammola
    • fix(types): avoid inferring doc type from param to create() #12001
    • fix(types): make populate Paths generic consistently overwrite doc interface #11955
    • fix(types): allow null at ne expression second parameter #11996 jyeros
    • fix(types): change index "weights" to be more explicit #11997 hasezoey

    6.4.1 / 2022-06-27

    ... (truncated)

    Changelog

    Sourced from mongoose's changelog.

    6.4.6 / 2022-07-20

    • fix(schema): disallow setting proto when creating schema with dotted properties #12085
    • fix(document): avoid mutating original object passed to $set() when applying defaults to nested properties #12102
    • fix(query): apply lean transform option to top-level document #12093
    • docs(migrating_to_6): correct example for isObjectIdOrHexString() #12123 LokeshKanumoori

    6.4.5 / 2022-07-18

    • fix(model+timestamps): set timestamps on subdocuments in insertMany() #12060
    • fix: correct isAtlas check #12110 skrtheboss
    • fix(types): fix various issues with auto typed schemas #12042 mohammad0-0ahmad
    • fix(types): allow any value for AddFields #12096
    • fix(types): allow arbitrary expressions for ConcatArrays #12058
    • fix(types): make $addToSet fields mutable to allow programatically constructing $addToSet #12091
    • fix(types): add $let as a possible expression to $addFields #12087 AbdelrahmanHafez
    • fix(types): fix $switch expression type #12088 AbdelrahmanHafez
    • fix(types): correct options type for syncIndexes() #12101 lpizzinidev
    • fix(types): avoid treating | undefined types as any in Require_id to better support _id: String with auto-typed schemas #12070
    • docs: fix up various jsdoc issues #12086 hasezoey
    • docs: add sanitizeFilter to mongoose.set() options #12112 pathei-kosmos

    6.4.4 / 2022-07-08

    6.4.3 / 2022-07-05

    • fix(document): handle validating deeply nested subdocuments underneath nested paths with required: false #12021
    • fix(types): infer schematype type from schema paths when calling SchemaType.path() #11987
    • fix(types): add $top and $topN aggregation operators #12053
    • fix(types): clean up a couple of issues with $add and $ifNull #12017
    • fix(types): allow $cond with $in #12028
    • docs: add path level descending index example in docs #12023 MitchellCash
    • docs: add Buffer, Decimal128, Map to docs #11971

    6.4.2 / 2022-07-01

    • fix: keep autoIndex & autoCreate as true by default if read preference is primaryPreferred #11976
    • fix(types): improve inferred Schema Type to handle nested paths and ObjectIds #12007 iammola
    • fix(types): avoid inferring doc type from param to create() #12001
    • fix(types): make populate Paths generic consistently overwrite doc interface #11955
    • fix(types): allow null at ne expression second parameter #11996 jyeros
    • fix(types): change index "weights" to be more explicit #11997 hasezoey

    6.4.1 / 2022-06-27

    ... (truncated)

    Commits
    • 5449ab9 chore: release 6.4.6
    • b8c99cf Merge pull request #11892 from Automattic/netlify-functions-example
    • 2751883 fix tests
    • eced2c7 Merge branch 'master' into netlify-functions-example
    • 92cb6fb Merge branch 'master' into vkarpov15/gh-12085
    • 422f9da test(schema): add coverage for calling plugin() with options
    • 2262a77 fix(document): avoid mutating original object passed to $set() when applying ...
    • 2e6b064 made requested changes
    • b70a0dc Merge pull request #12123 from LokeshKanumoori/patch-1
    • 086bd9f fix(query): apply lean transform option to top-level document
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add support for formatted UUIDs to the

    Add support for formatted UUIDs to the "from()" method.

    The library has several formating options, which is nice, however it only understands one of them when you "parse" a string with the from() method, which is weird.

    Steps to reproduce:

    const MUUID = require('uuid-mongodb');
    
    const uuid1 = MUUID.v4();
    console.log(uuid1); // Binary { ... }
    const string = uuid1.toString('N');
    console.log(string); // 9cea27b4d0e44781826ede1b6f378d6f
    
    const uuid2 = MUUID.from(string); // Error: Invalid UUID
    

    An optional parsing parameter like we have in the from method would make a lot of sense, e.g. MUUID.from(string, 'N');

    enhancement 
    opened by K41eb 2
  • Using for _id with mongodb v4 library in TypeScript

    Using for _id with mongodb v4 library in TypeScript

    In case someone else runs into this...I was using uuid-mongodb successfully with v3 of the mongodb library, using a UUID as the document _id. Had to upgrade to mongodb v4 and things broke.

    Finally found the clue here: https://jira.mongodb.org/browse/NODE-3532?focusedCommentId=3989765&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-3989765

    Here's some sample code, if you don't want to register. The key is using an interface ("IdDocument" below) as the generic when accessing client.db.collection.

    Need an interface:

    import { MUUID } from 'uuid-mongodb';
    
    export interface IdDocument {
      _id: MUUID;
      [keys: string]: any;
    }
    

    and then:

    import { v4, from, MUUID } from 'uuid-mongodb';
    
    const id = v4();
    const data = { _id: id,  someValue: 'heres a thing' };
    
    const coll = client.db('test').collection<IdDocument>('testids');
     
    await coll.insertOne(data);
    const output = await coll.findOne({_id: id }) as IdDocument;
    
    console.log(id.toString(), from(output?._id).toString());
    
    opened by pjboardman 2
  • Mongoose 5.13.8 troubles

    Mongoose 5.13.8 troubles

    Hello there. Not work implementation from examples with MUUID.from(this._id).toString(); this._id - is mongo lib object Now if fix with

    _id: {
      type: Buffer,
      subtype: 4,
      default: () => MUUID.v1(),
    },
    
    ....
    
    // virtual getter for custom _id
    schema
      .virtual("id")
      .get(function () {
        return MUUID.from(this._id.toBSON()).toString();
      })
      .set(function (val) {
        this._id = MUUID.from(val);
      });
    

    Is this a normal solution, or is it necessary to do something else?

    opened by Able1991 0
  • Validation won't pass when using mongoDB validation schema

    Validation won't pass when using mongoDB validation schema

    Hi, I'm trying to use the library to insert a new document that has a UUID as id in my collection. I would like this collection to have a validation schema to make sure that every ids of the documents inserted are UUIDs. However, when I'm specifying the BSON type 'object', the validation won't pass.

    I have seen in the examples that I could use mongoose, but I would prefer the validation to be perform at the database level. Do you have any idea of how I could make this work or any explanation of why it is not working? Thank you!

    Db migration code:

    const MUUID = require("uuid-mongodb");
    
    module.exports = {
      async up(db) {
    
        await db.createCollection("itemCategories", {
          validator: {
            $jsonSchema: {
              required: ["name", "_id"],
              bsonType: "object",
              properties: {
                _id: {"object"}, //I also tried with binData
                name: {
                  bsonType: "string",
                  maxLength: 50,
                },
                path: {
                  bsonType: ["string", "null"],
                  pattern: "^,([^,]+,)+$"
                }
              },
              additionalProperties: false,
            }
          },
        });
        await db.collection("itemCategories").createIndex({"name": 1}, {unique: true});
        await db.collection("itemCategories").insertMany([
          {_id: MUUID.v4(), name: "Sport", path: null},
          {_id: MUUID.v4(), name: "Tool", path: null},
          {_id: MUUID.v4(), name: "Entertainment", path: null}
        ]);
      },
    
      async down(db) {
        await db.dropCollection("itemCategories");
      }
    };
    

    And the error I get

    ERROR: Could not migrate up 20210627041314-create-categories.js: Document failed validation BulkWriteError: Document failed validation
        at OrderedBulkOperation.handleWriteError (C:\Users\username\projectDirectory\node_modules\mongodb\lib\bulk\common.js:1352:9)
        at resultHandler (C:\Users\username\projectDirectory\node_modules\mongodb\lib\bulk\common.js:579:23)
        at handler (C:\Users\username\projectDirectory\node_modules\mongodb\lib\core\sdam\topology.js:943:24)
        at C:\Users\username\projectDirectory\node_modules\mongodb\lib\cmap\connection_pool.js:350:13
        at handleOperationResult (C:\Users\username\projectDirectory\node_modules\mongodb\lib\core\sdam\server.js:558:5)
        at MessageStream.messageHandler (C:\Users\username\projectDirectory\node_modules\mongodb\lib\cmap\connection.js:281:5)
        at MessageStream.emit (events.js:321:20)
        at processIncomingData (C:\Users\username\projectDirectory\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
        at MessageStream._write (C:\Users\username\projectDirectory\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
        at doWrite (_stream_writable.js:441:12)
    
    opened by VicoF 0
  • MUUID.from() fails with CastError

    MUUID.from() fails with CastError

    v2.4.3 introduces: CastError: Cast to Buffer failed for value "new Binary(Buffer.from("bd8b82fd91604ebc8010f5026c0b1644", "hex"), 4)" at path "centre" for model "Queue"

    The code where it fails is as simple as:

    const rows = await MQueue.find({
        centre: MUUID.from(uuid),
        deletedAt: null
    })
    

    I can confirm that reverting to v2.4.2 fixes the issue

    opened by TisRyno 1
Releases(v2.5.3)
  • v2.5.3(Dec 27, 2022)

    2.5.3 (2022-12-27)

    • add examples to .npmignore (8e9cda2)
    • add support all mongo 4.x peers (ca054d9)
    • Updated dependencies (including the mongodb v4.13.x peer dependency). (acaa71a)
    • Updated the mongodb peer dependency to accept all 4.x versions due to the increased release cadence (c490436)

    2.5.2 (2022-12-14)

    • Added support for the mongodb 4.7.x driver in peer dependencies. (7cfcef2)
    • Added support for the mongodb 4.8.x driver in peer dependencies and updated dependencies to the late (715139b)
    • Added support for the MongoDB 4.9 driver. Updated other devDependencies to the latest versions. All (8a8f5a4)
    • Updated dependencies. Added support for the mongodb v4.6.x as a peer dependency. Remove the dev depe (ca726b1)
    • Updated to uuid version 9.0.0; Updated MongoDB peer dependencies to cover al versions through to V4. (60399ce)
    • v2.5.2 (666e5b9)

    2.5.0 (2022-01-02)

    • support all mongodb peer versions (197e9a3)

    2.4.3 (2021-04-18)

    • fix: example/package.json & example/package-lock.json to reduce vulnerabilities (b54f92b)
    • fix: upgrade mongoose from 5.11.8 to 5.11.9 (5ae3ad0)
    • chore(deps): bump y18n from 4.0.0 to 4.0.1 (83dec56)
    • allow 4.x betas (fffcea9)
    • missing new operator added (b9a313f)
    • Update uuid-mongodb_spec.js (fcbab01)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.5.2(Dec 14, 2022)

    2.5.2 (2022-12-14)

    • Added support for the mongodb 4.7.x driver in peer dependencies. (7cfcef2)
    • Added support for the mongodb 4.8.x driver in peer dependencies and updated dependencies to the late (715139b)
    • Added support for the MongoDB 4.9 driver. Updated other devDependencies to the latest versions. All (8a8f5a4)
    • Updated dependencies. Added support for the mongodb v4.6.x as a peer dependency. Remove the dev depe (ca726b1)
    • Updated to uuid version 9.0.0; Updated MongoDB peer dependencies to cover al versions through to V4. (60399ce)
    • v2.5.2 (666e5b9)

    2.5.0 (2022-01-02)

    • support all mongodb peer versions (197e9a3)

    2.4.3 (2021-04-18)

    • fix: example/package.json & example/package-lock.json to reduce vulnerabilities (b54f92b)
    • fix: upgrade mongoose from 5.11.8 to 5.11.9 (5ae3ad0)
    • chore(deps): bump y18n from 4.0.0 to 4.0.1 (83dec56)
    • allow 4.x betas (fffcea9)
    • missing new operator added (b9a313f)
    • Update uuid-mongodb_spec.js (fcbab01)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(Apr 8, 2022)

    2.5.0 (2022-01-02)

    • support all mongodb peer versions (197e9a3)

    2.4.3 (2021-04-18)

    • fix: example/package.json & example/package-lock.json to reduce vulnerabilities (b54f92b)
    • fix: upgrade mongoose from 5.11.8 to 5.11.9 (5ae3ad0)
    • chore(deps): bump y18n from 4.0.0 to 4.0.1 (83dec56)
    • allow 4.x betas (fffcea9)
    • missing new operator added (b9a313f)
    • Update uuid-mongodb_spec.js (fcbab01)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Jan 2, 2022)

    2.5.0 (2022-01-02)

    • support all mongodb peer versions (197e9a3)

    2.4.3 (2021-04-18)

    • fix: example/package.json & example/package-lock.json to reduce vulnerabilities (b54f92b)
    • fix: upgrade mongoose from 5.11.8 to 5.11.9 (5ae3ad0)
    • chore(deps): bump y18n from 4.0.0 to 4.0.1 (83dec56)
    • allow 4.x betas (fffcea9)
    • missing new operator added (b9a313f)
    • Update uuid-mongodb_spec.js (fcbab01)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.4.3(Apr 18, 2021)

    2.4.3 (2021-04-18)

    • fix: example/package.json & example/package-lock.json to reduce vulnerabilities (b54f92b)
    • fix: upgrade mongoose from 5.11.8 to 5.11.9 (5ae3ad0)
    • chore(deps): bump y18n from 4.0.0 to 4.0.1 (83dec56)
    • allow 4.x betas (fffcea9)
    • missing new operator added (b9a313f)
    • Update uuid-mongodb_spec.js (fcbab01)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.4.2(Feb 15, 2021)

    2.4.2 (2021-02-15)

    • chore: increment patch version (f7a8d0b)
    • updated typescript definition to include formatted toString (3022cd1)

    2.4.1 (2020-12-25)

    • feat: improved type declarations (ee26ce5)
    • chore: upgrade deps (c5de408)
    • Implemented the specific types used in the mode function so as not to break downstream typescript pr (79fd8c0)

    2.4.0 (2020-12-01)

    • chore: increment minor version (c61583f)
    • Exported type for mode (d2489a4)
    • update deps (781fb82)
    • fix: upgrade mongodb from 3.6.2 to 3.6.3 (8093b03)
    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Dec 25, 2020)

  • v2.4.0(Dec 1, 2020)

  • v2.2.1(Apr 24, 2020)

  • v2.0.1(May 31, 2019)

  • v2.0.0(May 25, 2019)

  • v1.1.4(Mar 9, 2019)

  • 1.1.2(Nov 17, 2018)

  • 1.0.2(Aug 9, 2018)

  • 0.9.1(Jul 30, 2018)

Owner
Carmine DiMascio
engineer ⋅ musician ⋅ always learning ⋅ @amzn, formerly @tripadvisor, @IBM
Carmine DiMascio
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite datab

MikroORM 5.4k Dec 31, 2022
E-Commerce Application developed with nodejs and stored to mongodb.

E-Commerce Application This Application has been developed with nodejs and mongodb. Environment Variables Create a file named config.env in config dir

Abdullah Öztürk 13 Dec 23, 2021
Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

DbGate 2k Dec 30, 2022
A back-end server aplication created using node.js, express and mongodb.

Course Material and FAQ for my Complete Node.js, Express and MongoDB Bootcamp This repo contains starter files and the finished project files for all

Pablo César Jiménez villeda 1 Jan 4, 2022
A starter template for Nest.js with MongoDB, GraphQL, JWT Auth, and more!

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Michael Guay 19 Dec 25, 2022
A Node.js ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud.

Dittorm A Node.js ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud. Installatio

Waline 21 Dec 25, 2022
A node.js locks library with support of Redis and MongoDB

locco A small and simple library to deal with race conditions in distributed systems by applying locks on resources. Currently, supports locking via R

Bohdan 5 Dec 13, 2022
MongoDB object modeling designed to work in an asynchronous environment.

Mongoose Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks. Do

Automattic 25.2k Dec 30, 2022
The Official MongoDB Node.js Driver

MongoDB NodeJS Driver The official MongoDB driver for Node.js. NOTE: v3.x released with breaking API changes. You can find a list of changes here. Ver

mongodb 9.6k Dec 28, 2022
🍹 MongoDB ODM for Node.js apps based on Redux

Lightweight and flexible MongoDB ODM for Node.js apps based on Redux. Features Flexible Mongorito is based on Redux, which opens the doors for customi

Vadim Demedes 1.4k Nov 30, 2022
A high performance MongoDB ORM for Node.js

Iridium A High Performance, IDE Friendly ODM for MongoDB Iridium is designed to offer a high performance, easy to use and above all, editor friendly O

Sierra Softworks 570 Dec 14, 2022
The ultimate solution for populating your MongoDB database.

Mongo Seeding The ultimate solution for populating your MongoDB database ?? Define MongoDB documents in JSON, JavaScript or even TypeScript files. Use

Paweł Kosiec 494 Dec 29, 2022
A MongoDB-like database built on top of Hyperbee with support for indexing

hyperbeedeebee A MongoDB-like database built on top of Hyperbee with support for indexing WIP: There may be breaking changes in the indexing before th

null 35 Dec 12, 2022
5-BackControlFinanzas - Node & MongoDB

API para APP 'Control Finanzas' Pequeña API/Backend creada para la aplicacion personal de Control Finanzas. Enlace de github a la aplicacion que requi

Ignacio Tirado 1 Jan 3, 2022
The Wholesome App. A project that allows you to upload images directly to MongoDB Atlas into your collection, a faster cloud database.

The Wholesome App. A project that allows you to upload images directly to MongoDB Atlas into your collection, a faster cloud database. To upload your cute and wholesome images.

Gourav Singh Rawat 2 Jul 17, 2022
A joi extension to validate MongoDB's ObjectIDs

@marsup/joi-objectid This is a simple joi extension to validate MongoDB's ObjectIDs. Installation npm install --save @marsup/joi-objectid Usage const

Nicolas Morel 2 Dec 15, 2022
AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a

Andrey Gershun 6.1k Jan 9, 2023
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used

null 30.1k Jan 3, 2023