Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document::create() #47

Open
thekid opened this issue Aug 16, 2024 · 0 comments
Open

Document::create() #47

thekid opened this issue Aug 16, 2024 · 0 comments

Comments

@thekid
Copy link
Member

thekid commented Aug 16, 2024

Idea: Introduce a new create() method to accomplish the following:

use com\mongodb\{Document, ObjectId};

// Before
$dialogue= new Document([
  '_id'          => ObjectId::create(),
  'owner'        => $identity,
  // ...
]);

// Before
$dialogue= Document::create([
  'owner'        => $identity,
  // ...
]);

Object IDs are created client-side in any instance, this new method would take care of instantiating a document and creating an ID for the case that we need to know it before insertion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant