Skip to content

Support entity canon zone / Workaround Duplicate Key / Support hint / Support BSON / Remove Mongo 3 Warnings#71

Open
jeromevalentin wants to merge 3 commits intosenecajs:masterfrom
jeromevalentin:multidb
Open

Support entity canon zone / Workaround Duplicate Key / Support hint / Support BSON / Remove Mongo 3 Warnings#71
jeromevalentin wants to merge 3 commits intosenecajs:masterfrom
jeromevalentin:multidb

Conversation

@jeromevalentin
Copy link

@jeromevalentin jeromevalentin commented Oct 1, 2018

  • Use the entity's zone as database name.

This is allowing one plugin to deal with multiple databases on the same computer. The mongo connection (MongoClient) is hold by the plugin, and the db/name or name part of the database URI is now optional. The plugin will use the entity's zone as database name or the database name provided in option as default database if no zone is provided in the managed entity.
Then all entity related operations are done on the corresponding database through the same MongoClient!

  • Add mongodb recommended workaround on duplicate key on update/replace (reduce coveralls ratio to 84 instead of 85). In case of E1100 error during an update/replace operation, the store will automatically perform a retry and is generating a seneca warning log.

  • Add support of mongo hint in query by using the hint$ property in query, you can now help mongo driver to select the right index to use. (see https://docs.mongodb.com/manual/reference/operator/meta/hint/)

  • Remove Dot-notation dependency to support BSON fields

  • Remove all warnings due to mongodb 3 usage:

    • 'fields' is replaced by 'projection' in meta query
    • 'collection.each' is replaced by 'collection.forEach'
    • 'collection.remove' is replaced by 'collection.deleteOne' or 'collection.deleteMany'
    • 'useNewUrlParser: true' is used as MongoClient.connect option

+ Add mongodb recommended workaround on duplicate key on update/replace (reduce coveralls ratio to 84 instead of 85)
+ Add support of mongo hint in query
@jeromevalentin jeromevalentin changed the title Add support of entity's canon zone to database mapping Add support of entity's canon zone as database mapping Oct 1, 2018
@jeromevalentin jeromevalentin changed the title Add support of entity's canon zone as database mapping Support entity canon zone / Workaround Duplicate Key / Support hint / Support BSON / Remove Mongo 3 Warnings Oct 2, 2018
@rjrodger
Copy link
Collaborator

Awesome! Will need consideration in the context of overall seneca-entity design considerations.

@rjrodger rjrodger added the motivator Great idea; PR waiting on design work by core team. label May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

motivator Great idea; PR waiting on design work by core team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants