Version: 2.2.0 (última)
MongoDB (noSQL)
#
Creating a new projectTo generate a new project that uses MongoDB, run the command createapp
with the flag --mongodb
.
#
Configuration- YAML
- JSON
- JS
#
Defining Entities and ColumnsMore documentation here: https://github.com/typeorm/typeorm/blob/master/docs/mongodb.md.
The definition of entities and columns is the same as in relational databases, except that the ID type must be an ObjectID
and the column decorator must be @ObjectIdColumn
.
Example
#
AuthenticationfetchMongoDBUser
function#
The user.entity.ts
Example with JSON Web Tokens:
MongoDBStore
#
The If you use sessions with @UseSessions
, you must use the MongoDBStore
from @foal/mongodb
. The TypeORMStore
does not work with noSQL databases.
#
LimitationsWhen using MongoDB, there are some features that are not available:
- the
foal g rest-api <name>
command, - and the Groups & Permissions system.