-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: TypeScript
Use Case
As a Typescript user I want to be able to declare a schema-less collection that permits the _id field to be any type, instead of the default ObjectId so that code is written with less effort when I'm not concerned about type safety.
Dependencies
- Our type definitions we publish
Unknowns
- Is this possible? Currently we default the _id type to ObjectId because when its not specified that is infact the type that mongodb will insert but it doesn't mean users can't use another type.
- Is this a breaking change if introduced later? Seems like we're strict now and could reduce the strictness later without harm.
Acceptance Criteria
Implementation Requirements
- I should be able to have this code be errorless:
Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
const collection = db.collection('c') // No schema collection.insertOne({ _id: 1 }) // non ObjectId type
Testing Requirements
- Uncomment test found in test/types/community/collection/insertX.test-d.ts
Documentation Requirements
- n/a
Follow Up Requirements
- n/a
- is related to
-
NODE-3532 v4.4.1 doesn't allow UUID as the type for _id.
- Closed