mongoose schema dynamic key

2014年11月4日 — You'll be better off if you avoid dynamic keys in your schema and go with your second idea of: user_info: ...

mongoose schema dynamic key

2014年11月4日 — You'll be better off if you avoid dynamic keys in your schema and go with your second idea of: user_info: [sessionid: String, value: String}]. ,I don't think it is possible to literally have a dynamic key as that defeats the purpose of a schema, but you could do something like this: var KeyValueSchema​ ...

相關軟體 MongoDB 資訊

MongoDB
MongoDB 是一個免費且開放源碼的跨平檯面向文檔的數據庫程序。分類為 NoSQL 數據庫程序,MongoDB 使用類似 JSON 的文檔與模式。它為使用 MongoDB 包括數據庫開發人員和 DBA 的任何人提供了豐富的 GUI 工具。主要功能包括:全功能嵌入 MongoDB Shell,用戶友好的 Map-Reduce 操作編輯器,創建 / 刪除數據庫,管理集合及其索引的能力,用戶友好的 G... MongoDB 軟體介紹

mongoose schema dynamic key 相關參考資料
How to use mongoose model schema with dynamic keys ...

2019年3月26日 — The same issue schema with variable key is talked in mongoose,. Nope not currently possible. Closest alternative is to use strict: false or the ...

https://stackoverflow.com

Mongoose variable key name - Stack Overflow

2014年11月4日 — You'll be better off if you avoid dynamic keys in your schema and go with your second idea of: user_info: [sessionid: String, value: String}].

https://stackoverflow.com

Dynamic schema keys in Mongoose - Stack Overflow

I don't think it is possible to literally have a dynamic key as that defeats the purpose of a schema, but you could do something like this: var KeyValueSchema​ ...

https://stackoverflow.com

How do i declare a dynamic key in an object for a Mongoose ...

2021年2月18日 — how do i declare the above in a mongoose schema as the key value for the object is variable. Can i just use alerts: [Object] or alerts: [Schema.

https://stackoverflow.com

How do you define a mongoDB mongoose schema for a ...

2018年3月11日 — I have a MongoDB collection users where I want to store a dictionary with dynamic keys. I want users to look like this within MongoDB: _id: $ ...

https://stackoverflow.com

how to validate dynamic key of mongoose schema - Stack ...

2014年4月17日 — You may want to look into this: http://mongoosejs.com/docs/middleware.html. Specifically pre-save events. Mongoose gives you control over ...

https://stackoverflow.com

How to create mongoose schema with dynamic keys using ...

2021年6月10日 — I have a requirement where I have to put dynamic keys of type string. I found this on Mongoose docs on how to create dynamic keys using Map ...

https://stackoverflow.com

How to query a dynamic key - mongodb schema design ...

2018年8月23日 — I'd recommend restructuring the model. _id : 1, data: [ key : key1, samekeyA : value1, samekeyB : value2 }, key : key2, samekeyA ...

https://stackoverflow.com

JSON Schema with dynamic key field in MongoDB - Stack ...

2013年7月26日 — It is not a good practice to have values as keys. The language codes are values and as you say you can not validate them against a schema.

https://stackoverflow.com

docs embedded in object w arbitrary keys? · Issue #681 ...

I wanted to have dynamic keys with strongly typed schema values. It would be fantastic if we could avoid having to handroll the validation. new mongoose.

https://github.com