You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,8 @@ You can also **check out [a video introduction of a talk I gave at Devoxx France
76
76
-[Can it be used in $routeProvider.resolve?](#can-it-be-used-in-routeproviderresolve)
77
77
-[My response is actually wrapped with some metadata. How do I get the data in that case?](#my-response-is-actually-wrapped-with-some-metadata-how-do-i-get-the-data-in-that-case)
78
78
-[I use Mongo and the ID of the elements is _id not id as the default. Therefore requests are sent to undefined routes](#i-use-mongo-and-the-id-of-the-elements-is-_id-not-id-as-the-default-therefore-requests-are-sent-to-undefined-routes)
79
+
-[I use Mongo and the ID of the elements is `_id` and is encapsulated inside the $oid attribute](#i-use-mongo-and-the-etag-of-the-elements-is-_etag-and-is-encapsulated-inside-the-oid-attribute)
80
+
-[I use Mongo and the ETag of the elements is `_etag` and is encapsulated inside the $oid attribute](#i-use-mongo-and-the-etag-of-the-elements-is-_etag-and-is-encapsulated-inside-the-oid-attribute)
79
81
-[What if each of my models has a different ID name like CustomerID for Customer](#what-if-each-of-my-models-has-a-different-id-name-like-customerid-for-customer)
80
82
-[How do I handle CRUD operations in a List returned by Restangular?](#how-do-i-handle-crud-operations-in-a-list-returned-by-restangular)
81
83
-[When I set baseUrl with a port, it's stripped out.](#when-i-set-baseurl-with-a-port-its-stripped-out)
#### **I use Mongo and the ID of the elements is `_id` and is encapsulated inside the $oid attribute**
1157
+
1158
+
What you need to do is to configure the `RestangularFields` and set the `id` field to `_id.$oid`. Let's see how:
1159
+
1160
+
````javascript
1161
+
RestangularProvider.setRestangularFields({
1162
+
id:"_id.$oid"
1163
+
});
1164
+
````
1165
+
1166
+
#### **I use Mongo and the ETag of the elements is `_etag` and is encapsulated inside the $oid attribute**
1167
+
1168
+
What you need to do is to configure the `RestangularFields` and set the `etag` field to `_etag.$oid`. Let's see how:
1169
+
1170
+
````javascript
1171
+
RestangularProvider.setRestangularFields({
1172
+
etag:"_etag.$oid"
1173
+
});
1174
+
````
1175
+
1154
1176
#### **What if each of my models has a different ID name like CustomerID for Customer**
1155
1177
1156
1178
In some cases, people have different ID name for each entity. For example, they have CustomerID for customer and EquipmentID for Equipment. If that's the case, you can override Restangular's getIdFromElem. For that, you need to do:
0 commit comments