Mongo Vue 操作方法 – 码农在线

Mongo Vue 操作方法

1.更新colltions

{$set:{ "Status" : "交易成功",}}

2.模糊查询List类型的colltions

{"sys_category":new RegExp("213.*")} 

3.MongoDB强制使用主库,主库优先等配置说明

只需要修改readPreference配置,举例如下 具体参数参考以下。PRIMARY: Read from the primary. This is the default, and provides the strongest consistency. If no primary is available, raise AutoReconnect.PRIMARY_PREFERRED: Read from the primary if available, or if there is none, read from a secondary.SECONDARY: Read from a secondary. If no secondary is available, raise AutoReconnect.SECONDARY_PREFERRED: Read from a secondary if available, otherwise from the primary.NEAREST: Read from any member.