简体   繁体   English

使用Grails将列表保存在mongodb中

[英]Save list in mongodb using grails

im new to mongodb so a little confused on how do i save the list object in mongodb using grails, basically i have a list of hasmap , which is in turn is a string,list map , like this 我是mongodb的新手,所以我对如何使用grails在mongodb中保存列表对象有些困惑,基本上我有一个hasmap列表,而hasmap列表又是一个字符串,列表映射,像这样

List<HashMap<String, ArrayList<Object>>> changedProperties = new ArrayList<HashMap<String, ArrayList<Object>>>()

and here is my domain class that have this type of property 这是我的具有此类属性的域类

class DatabaseEvent {

String type
String entityClass
String objectId
Date dateCreated
User loggedInUser
List<HashMap<String, ArrayList<Object>>> changedProperties
}

if i simply pass this type of list , it is not saving. 如果我只是通过这种类型的列表,则无法保存。

[[description:[null, some test]], [name:[Testing 12, Testing 1]], [displayOrder:[4, 11]]]

im passing the above list , but it rejects with this error 我通过上面的列表,但它拒绝此错误

rejected value [[{description=[null, some test]}, {name=[Testing 12, Testing 1]}, {displayOrder=[4, 11]}]] 

Check out this link. 查看此链接。

Grails in the Land of MongoDB MongoDB土地上的Grails

http://blog.mongodb.org/post/18510469058/grails-in-the-land-of-mongodb http://blog.mongodb.org/post/18510469058/grails-in-the-land-of-mongodb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM