loopbackio / loopbackio/loopback-connector-mongodb

v.match is not a function

Open
#735 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
186
Forks
238
Avg merge
2h 49m
Merged PRs (30d)
1

Description

The function below is fixed and merged in the v5.x branch but wasn't released for loopback3. Is there a specific version which support loopback3 and have this fix.

function isObjectIDProperty(modelCtor, propDef, value, options) {
  if (!propDef) return false;

  if ((typeof value === 'string' && value.match(ObjectIdValueRegex)) ||
    (Array.isArray(value) && value.every((v) => v.match(ObjectIdValueRegex)))) {
    if (isStoredAsObjectID(propDef)) return true;
    else return !isStrictObjectIDCoercionEnabled(modelCtor, options);
  } else if (value instanceof mongodb.ObjectID) {
    return true;
  } else {
    return false;
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the shown isObjectIDProperty function with the v5.x branch and reviewing the connector's release history for LoopBack 3 compatibility. Confirm whether the fix was included in a released version that supports LoopBack 3; if not, document that no such release is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.