Skip to content

Commit 0e369f5

Browse files
authored
Update README.md
1 parent 3723d17 commit 0e369f5

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,27 @@ To update password:
9090

9191
If it doesn't work, simply alter Vulcan Next password check method so it fall back to `services.password.bcrypt` to find the hashed password, see https://willvincent.com/2018/08/09/replicating-meteors-password-hashing-implementation/
9292
93-
Example code:
93+
Example structure of a user:
94+
```json
95+
{
96+
"_id":"RXSk3HJemC6haii64",
97+
"username":"administrator",
98+
"email":"[email protected]",
99+
"isDummy":false,
100+
"groups":["admins"],
101+
"isAdmin":true,
102+
"emails":[{"address":"[email protected]"}],
103+
"createdAt":{"$date":"2021-12-29T11:43:29.772Z"},
104+
"displayName":"administrator",
105+
"slug":"administrator",
106+
// this part contains the password, it is populated by Meteor
107+
// services.password.bcrypt = XXX
108+
"services":{},
109+
"status":{"online":false}}
94110
```
111+
112+
Example code:
113+
```ts
95114
export const checkPasswordForUser = (
96115
user: Pick<UserTypeServer, "hash" | "salt">,
97116
passwordToTest: string
@@ -123,12 +142,15 @@ To update password:
123142
- TODO: See https://github.com/VulcanJS/vulcan-npm/issues/63.
124143
Meteor uses string `_id` as a default, while Mongo uses `ObjectId` type, so you need to do `ObjectId.str` to get the actual id or use a method like `isEqual` from lodash. **This means that objects created using Next backend might create bugs in the Meteor backend**. You need to avoid that, by doing creation operations only in Meteor, or to clearly separate things you manage in Next and things you manage in Meteor until you have fully transitionned.
125144
145+
### Reuse the meteor database
146+
126147
- If you plan to reuse your existing Meteor database in Next, this means you might need to parse all documents and change the "string" `_id` to an `ObjectId`, see https://forums.meteor.com/t/convert-meteor-mongo-string--id-into-objectid/19782.
127148
You can change the `_id` generation scheme (see https://docs.meteor.com/api/collections.html) to ObjectId in the Meteor app if you need a progressive transition.
128149
TODO: We still have an issue with `function convertIdAndTransformToJSON<TModel>`, it tries to access `document._id` for string conversion but it seems to be undefined when using a Meteor Mongo database.
129150
**Current workaround:**: clone users mnually in Compass, it will recreate an id as an ObjectID https://docs.mongodb.com/compass/current/documents/clone/
130151
**Better workaround**: force mongoose to use string ids in the Vulcan Next model https://forums.meteor.com/t/using-mongoose-to-query-a-mongo-db-that-was-from-a-meteor-db/53789
131152
153+
132154
## Caveats
133155
134156
- Check Vulcan NPM migration documentation to see the difference between Vulcan Meteor and Vulcan Next: https://github.com/VulcanJS/vulcan-npm/blob/devel/MIGRATING.md

0 commit comments

Comments
 (0)