2.1.0 • Published 2 years ago

coactive-node-api-recruitment v2.1.0

Weekly downloads
-
License
UNLICENSED
Repository
bitbucket
Last release
2 years ago

Recruitment API

Use YARN as your package manager, not npm!

Writing Tests

Quite often you'll need to write tests with objects that need unique IDs, e.g.

{
    "_id": { "$oid": "60096ef65f442f27745682b6" },
    "id": {
        "$binary": { "base64": "/vyWiAZlTwOx0JLUzhT0nQ==", "subType": "04" }
    },
    "userId": {
        "$binary": { "base64": "HXuCdG4jT2q1P90onEsxSQ==", "subType": "04" }
    },
    "jobOpportunityId": {
        "$binary": { "base64": "t8dKhc1ORUyYAp7Hr4rcvw==", "subType": "04" }
    },
    "user": {
        "email": "test@example.org"
    },
    ...

The _id is the Mongo ID.

The id is our UUIDv4 compatible id, stored in binary format.

Use MongoSH to convert UUIDs to/from base64:

> let id = UUID('04782ebe-b6a2-42fc-9a6c-93bbc076bbed');
> id.toString('base64')
< 'BHguvraiQvyabJO7wHa77Q=='
> BinData(4,'BHguvraiQvyabJO7wHa77Q==')
< UUID("04782ebe-b6a2-42fc-9a6c-93bbc076bbed")

Generate Mongo IDs:

> bjectId()
< ObjectId("6114d62a2b2ea447fc7630f0")